<asp:TemplateField HeaderText="Sub Item Name" HeaderStyle-HorizontalAlign="Center" ControlStyle-Width="200" > <ItemTemplate> <asp:LinkButton ID="lblSubItemName" runat="server" Text='<%# Eval("SubItemName")%>' OnClick="lblSubItemName_Click"> </asp:LinkButton> </ItemTemplate>
</asp:TemplateField>
ItemName = TryCast(gdBOM.SelectedRow.FindControl("lblSubItemName"), LinkButton).Text
You can Check this Article...
Quote:The problem is that when you click a button in a GridView, the row will only be a Clicked Row and not a SelectedRow. If you wanna make it the SelectedRow you have to specify CommandName="Select" in the Button's markup.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)