FindControl on a Wizard

S

Srini

I customized the SideBarTemplate of the Wizard control and added a Label with ID Label1 to it.
I want to change the Text of the label based on the current step. But the following always returns null
Label L = (Label)Wizard1.FindControl( "Label1" );

As per the help file, this should return the Label.

Here is the script for the template

<SideBarTemplate>

<asp:DataList ID="SideBarList" runat="server" Height="90px" Width="162px">

<SelectedItemStyle Font-Bold="True" />

<ItemTemplate>

<asp:LinkButton ID="SideBarButton" runat="server"></asp:LinkButton>

</ItemTemplate>

</asp:DataList><br />

&nbsp;<asp:Button ID="Button1" runat="server" Text="Button" Visible="False" />

<br />

<asp:Label ID="Label1" runat="server" BackColor="Black" Font-Names="Tahoma" Font-Size="X-Small"

ForeColor="#FFFF80" Text="Label" Width="167px"></asp:Label>

</SideBarTemplate>

Any help appreciated.

Thanks in Advance
 
S

Srini

Anyone ? I searched group and web. no use.
I have to switch to a Multiview if this does not work.

Thanks
I customized the SideBarTemplate of the Wizard control and added a Label
with ID Label1 to it.
I want to change the Text of the label based on the current step. But the
following always returns null
Label L = (Label)Wizard1.FindControl( "Label1" );
As per the help file, this should return the Label.
Here is the script for the template
<SideBarTemplate>
<asp:DataList ID="SideBarList" runat="server" Height="90px" Width="162px">
<SelectedItemStyle Font-Bold="True" />
<ItemTemplate>
<asp:LinkButton ID="SideBarButton" runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:DataList><br />
&nbsp;<asp:Button ID="Button1" runat="server" Text="Button" Visible="False"
/>
<br />
<asp:Label ID="Label1" runat="server" BackColor="Black" Font-Names="Tahoma"
Font-Size="X-Small"
ForeColor="#FFFF80" Text="Label" Width="167px"></asp:Label>
</SideBarTemplate>
Any help appreciated.
Thanks in Advance
 
G

Guest

Srini,

First you need to get access to the SideBarContainer and the SideBarList.
Your Label will be in the SideBar datalist.

Control lst1 = (Control)wizRecordAttendance.FindContro("SideBarContainer");
DataList lst = (DataList) lst1.FindControl("SideBarList");

foreach (DataListItem ctrl in lst.Items)
{
Label lbl = (Label ) ctrl.FindControl("Label1");
}
 

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

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top