DataList - Embedded Controls
Messages   Related Types
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

Reply to this message...
 
    
Dennis West
Dean goto http://aspalliance.com/dotnetsolutions/GetSolution.aspx?ID=9860

over 2500 ASP.Net Solutions at http://aspalliance.com/dotnetsolutions

sign-up for our Newsletter of Daily Dot.Net Solutions
----- Original Message -----
From: "Dean Santillan" <Click here to reveal e-mail address>
To: "aspngcontrolscs" <Click here to reveal e-mail address>
Sent: Tuesday, May 21, 2002 5:24 AM
Subject: [aspngcontrolscs] DataList - Embedded Controls

[Original message clipped]

Reply to this message...
 
 
System.Web.UI.WebControls.Button
System.Web.UI.WebControls.DataList
System.Web.UI.WebControls.DropDownList
System.Web.UI.WebControls.HyperLink
System.Web.UI.WebControls.Label
System.Web.UI.WebControls.LinkButton
System.Web.UI.WebControls.ListItem
System.Windows.Forms.ToolTip
System.Xml.XmlNode




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com