My GridView displays a list of names. On double clicking the name, the name should be set in a textbox. This should happen without any postback. We will use client side scripts for the OnDblClick
event handler.
To set client side event handlers, use the RowCreated
event of GridView.
<asp:TextBox ID="txtSearch" runat="server"/> <asp:GridView ID="gvMain" runat="server" AutoGenerateColumns="false" OnRowCreated="gvMain_RowCreated"> <Columns> <asp:BoundField HeaderText="Name" DataField="Name" /> </Columns> </asp:GridView>
RowCreated
event handler sets the OnDblClick
event handler.…