This message was discovered on ASPFriends.com 'aspngcontrolscs' list.
| Dean Santillan |
Hi,
I am interested to know how I can manipulate the properties of web form controls embedded in the header template of the datalist.
I have a datalist that has label controls in the header template that i would like to change the text of according to the querystring. I am able to access all the web from controls on the page but not in the datalist control.
I really have no idea where i should begin or what to look for. I played with it all i can see is to get a the datalistitem and then work my through that. But how is where i stop.
Any ideas or articles on this topic would be appreciated.
This how i am working through the controls foreach (XmlNode anode in nodes) { Control c = MyUserControl.FindControl(anode.Name); if (c != null) { switch ( c.GetType().ToString()) { case "System.Web.UI.WebControls.Label": Label lb = (Label) c; lb.Text = anode.Attributes["Value"].Value; break; case "System.Web.UI.WebControls.LinkButton": LinkButton lk = (LinkButton) c; lk.Text = anode.Attributes["Value"].InnerText; break; case "System.Web.UI.WebControls.HyperLink": HyperLink hl = (HyperLink) c; hl.Text = anode.Attributes["Value"].InnerText; break; case "System.Web.UI.WebControls.Button": Button NewBut = (Button) c; NewBut.Text = anode.Attributes["Value"].InnerText; break; case "System.Web.UI.WebControls.DataList": DataList NewDataList = (DataList)c; break; case "System.Web.UI.WebControls.DropDownList": DropDownList ddl = (DropDownList) c; foreach (XmlNode itemNode in anode.ChildNodes) { ListItem li = new ListItem(); li.Text = itemNode["text"][Language].InnerText; li.Value = itemNode["value"].InnerText; ddl.Items.Add(li); } break; } } } This is my xml file
<Ascx> <!-- --> <ControlTitle Language="En" Css="" Value="View Site Sections" ToolTip="" /> <ControlTitle Language="Ja" Css="" Value="?????????????" ToolTip="" /> <!-- --> <InstrText Language="En" Css="" Value="Select from the links int the list below to edit or add a section to the site." ToolTip="" /> <InstrText Language="Ja" Css="" Value="?????????????" ToolTip="" /> <!-- --> <NewPage Language="En" Css="" Value="Add New Site Section" ToolTip="" /> <NewPage Language="Ja" Css="" Value="?????????????" ToolTip="" /> <!-- --> <LbID Language="En" Css="" Value="ID:" ToolTip="" /> <LbID Language="Ja" Css="" Value="??" ToolTip="" /> <!-- --> <Section Language="En" Css="" Value="Name:" ToolTip="" /> <Section Language="Ja" Css="" Value="??" ToolTip="" /> <!-- --> <Edit Language="En" Css="" Value="Edited:" ToolTip="" /> <Edit Language="Ja" Css="" Value="Edited:" ToolTip="" /> <!-- --> <TEMP Language="En" Css="" Value="TEMP" ToolTip="" /> <TEMP Language="Ja" Css="" Value="?????????????" ToolTip="" /> <!-- --> <TEMP Language="En" Css="" Value="TEMP" ToolTip="" /> <TEMP Language="Ja" Css="" Value="?????????????" ToolTip="" /> </Ascx>
Thanks Dean Santillan
|
|
| |
| | |
|
|
|
|