Hello,
Software: NetAdvantage Ultimate 11.2 w/ latest service pack.
I have a WebExplorerBar with a template that sits inside of a WebSplitter. Inside the template I have a couple Labels that I gave the ID of city1, city2, and city3.
<ig:ItemTemplate runat="server" TemplateID="tmplCities"><Template><table style="position: relative;"><tr><td><table><tr><td><asp:Label ID="city1" runat="server" CssClass="lbl-bold" Width="150px" Text=""></asp:Label></td></tr><tr><td><asp:Label ID="city2" runat="server" CssClass="lbl-bold" Width="150px" Text=""></asp:Label></td></tr><tr><td><asp:Label ID="city3" runat="server" CssClass="lbl-bold" Width="150px" Text=""></asp:Label></td></tr></table></Template></ig:ItemTemplate>The cities are suppose to come from the codebehind in the On_Load function. When I run the code, the cities are not being populated. When i do a view source I see the labels were given a much different id than what I typed in:
city1 = ctl00_ctl00_main_body_default_body_WebSplitter1_tmpl0_WebExplorerBar1_tree_3_0_city1city2 = ctl00_ctl00_main_body_default_body_WebSplitter1_tmpl0_WebExplorerBar1_tree_3_0_city2city3 = ctl00_ctl00_main_body_default_body_WebSplitter1_tmpl0_WebExplorerBar1_tree_3_0_city3
Qeustions:Why did all this garbage get appended onto my id? Is this id going to change over a period of time? Is this id going to be different on each server i place the code on?How do i use the ID that i typed in?
EDIT: I also tried to do a WebDataGrid inside an ItemTemplate as well with the data binding coming from the codebehind and that will not work (same garbage appended to the ID so the code behind can't find a reference to the control). Only works if i place the SqlDataSource inside the ItemTemplate which is not an option. The data has to come from the code behind.
Thanks....
Hi Shane,
Thank you for posting in the community.
The templated controls in your case havbe their IDs assigned based on their respective naming containers. More detailed information on how control identification for ASP.NET works may be found at:
http://msdn.microsoft.com/en-us/library/1d04y8ss.aspx
If you wish your templated controls to retain the same client id as assigned for their ID property I suggest that you set their ClientIDMode to "Static" .
Please let me know if this helps.