By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,686 Members | 1,109 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,686 IT Pros & Developers. It's quick & easy.

Xml Web Server control doesn't maintain state?

P: n/a
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;
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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!
Nov 18 '05 #2

P: n/a
Thanks

Do you know of any MS documentation that describes this behavior? Thanks again. Dave.
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.