In my WebDataGrid I have an ImageButton. I used the ImageButton to go to the parent listening of my datasource.
I have implemented the OnClick event and it works.
Now I want to disable the button and change the image of the button in the code behind. Is’t possible to receive the instance of the button?
My aspx code:
<Columns>
<ig:TemplateDataField Key="Image" Width="24px">
<HeaderTemplate>
<asp:ImageButton ID="btnDirUp" runat="server"
ImageUrl="~/Images/Up.png" onclick="btnDirUp_Click" />
</HeaderTemplate>
</ig:TemplateDataField>
<ig:BoundDataField DataFieldName="Name" Key="Name">
<Header Text="Name" />
</ig:BoundDataField>
</Columns>
I have tried this, but it doesn't work (the code returns null values):
Control ctrl = wdgFiles.Columns["Image"].Header.TemplateContainer.FindControl("btnDirUp");
if (ctrl is ImageButton)
{
return ((ImageButton)ctrl);
}
else
return null;
How can I get the instance of this control?
Hello,This should be fixed in the latest service release.
Alex,
I'm on the latest service pack (2087) and this doesn't work for me either. I have an ASP.NET label in my caption and when I try to get/find the control it always returns nothing. Even the TemplateContainer.Controls count is 0.
I'm trying the following in VB.NET:
Dim ctrl As Control = .Columns("Cage").Header.TemplateContainer.FindControl("lblCageHeading")
I know I have that control in the header. Any ideas on what I am doing wrong??
/Tom
Hi, any news on this? It's very urgent to me...