Hi,
i have a gridview that has only one column but multiple rows that i converted into a template column.
I have a linkbutton in this column that when clicked should collect the rows primary data key (forumId) and then insert it into a querystring and redirect to the threads page.
How do i select a datakey in the code behind file for the selected row without using the Selectedindexchanged event handler?
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="lnkForumName" runat="server" Text='<%# Bind("Title") %>'
CommandName="Select" onclick="lnkForumName_Click"></asp:LinkButton>
<br />
<asp:Label ID="lblForumDescription" runat="server"
Text='<%# Eval("Description") %>' CssClass="Forum_Description"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="lnkForumName" runat="server" Text='<%# Bind("Title") %>'
onclick="lnkForumName_Click"></asp:LinkButton>
<br />
<asp:Label ID="lblForumDescription" runat="server"
Text='<%# Eval("Description") %>' CssClass="Forum_Description"></asp:Label>
</ItemTemplate>
</asp:TemplateField>