There are few gridviews in the page. First gridview is editable, second is not. First gridview has a column that has a hyperlink (linkbutton). The second table should be loaded based on the click event of above hyper link. It is like expecting the hyperlink to behave like a button. Can this be done?
In order even try, I am not sure where to start. I added a hyperlink to the first gridview column. But what to set for the NavigationURL is doubtful to me.
There are only handful of events in a hyperlink control.
None of that seems to do what I need. Any tutorial is valuable.
Update: Gird markup code
<div id="schedule">
<asp:GridView ID="gvSchedule"
runat="server" AutoGenerateColumns="false"
CssClass="Grid"
DataKeyNames="Employee ID, WOY, Location"
ShowHeader="false"
RowStyle-CssClass="rowstyle"
onrowdatabound="gvSchedule_RowDataBound">
<Columns>
<asp:BoundField HeaderText="Staff"
DataField="E_Name" SortExpression="E_Name"
ItemStyle-Width="113" />
</Columns>
</asp:GridView>
<br />
</div>
Tried out a linkbutton as per this solution here
<asp:TemplateField HeaderText="StaffClick" SortExpression="STOCK NO" ItemStyle-Width="50">
<ItemTemplate>
<asp:LinkButton ID="lblStaff" runat="server">Click</asp:LinkButton>
</ItemTemplate>
<HeaderStyle BackColor="Black" ForeColor="White" HorizontalAlign="Left"/>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
After using this code, now none of the fields with checkboxes are loaded with rowbound event.
Put a LinkButton in your GridView, and use the "RowCommand" action to set what's supposed to happen. As soon as the link gets clicked, an Event called RowCommand is dispatched. You can handle whatever needs to happen server-side.
CommandArgument can be anything you want to pass to the function on the server side.
Here's an example:
And on the server side you could do this (C#):