Xml Web Server control doesn't maintain state?

G

Guest

Hi

I have a Xml Web Server control on my page

<asp:Xml id=Xml1 runat="server" EnableViewState="True"></asp:Xml>

I'm doing a transform as follows

System.Xml.XmlDocument doc = new System.Xml.XmlDocument()
doc.LoadXml(sXml)
XslTransform transform = new XslTransform()
transform.Load(Server.MapPath("./Xslt/DeloitteQuickLinks.xslt"))
Xml1.Document = doc
Xml1.Transform = transform

But on postback's the control doesn't maintain it's state and is blank after the post. If I do a transform directly to a label control as follows, it keeps it state between posts. Does this make sense?

...
System.IO.Stream stm = new MemoryStream()
transform.Transform(XmlDoc, xslArg, stm, new XmlUrlResolver())
stm.Position = 0
StreamReader sr = new StreamReader(stm)
string strStream = sr.ReadToEnd()
//Display transfrom
lblMenu.Text= strStream;
 
N

Natty Gur

Hi,

Yes XML control doesn't override IstateManager.LoadViewState. Therefore
XML isn't loading it own state from __ViewState. XML derived from
Control. Control implementation of LoadViewState just load control
visible attribute.

Label override LoadViewState therefore maintains state. Textbox dosen't
need to maintain state INPUT values are automatically sent via Form on
any request.

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
G

Guest

Thanks

Do you know of any MS documentation that describes this behavior? Thanks again. Dave.
 

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

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top