C# asp:TemplateField

Joined
Mar 23, 2011
Messages
1
Reaction score
0
I have the following code in Page.aspx in a gridview wich is tied to a database:
<asp:TemplateField
<ItemTemplate>
<asp:LinkButton CommandName="Select" Text="More" Runat="Server" ID="lbMore" Visible="false" >
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>

In the Page.aspx.cs i want that when a record is selected the linkbutton lbMore to change the visible proprety to true.
I tried the following but it doesn't work:

protected void gvDetails_SelectedIndexChanged(object sender, EventArgs e)
LinkButton linkButton = (LinkButton)FindControl("lbMore");
linkButton.Visible = true;

I also tried:
LinkButton linkButton = (LinkButton)gvDetails.FindControl("lbMore");
linkButton.Visible = true;

If someone could help me i'd be really greatfully.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top