Handle button click event inside gridview

buttonclickgridviewhandle

I am writing asp.net project in C#.

The page consists of gridview, it is filled from database initially. The buttons, textboxes and dropdownlists are inside gridview as in the picture picture.

gridview

I want to handle button(сообщить) click event so that I know what row of gridview is clicked in order to get the selected value of dropdowlnist and value of textbox from that row to update the database.

Does someone know how to do this?
Thanks!

Best Answer

My first thought is that if you are using the <asp:TemplateField> tags inside your gridview page, then you should be able to register an event in your button code as such: <asp:Button runat="server" OnClick="MyOnClickEvent" />. If you are programmatically adding them, you should be able to use the onClientClick property of the button.

Try reading http://www.codeproject.com/Articles/50540/GridView-Event-Handling. It might point you in the right direction.

Related Topic