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

need urgent help !

P: n/a
I have user controls(.ascx) programmed to function as modules on the same
page - default.aspx.
As you would be well aware, default.aspx has the normal html stuff:-
<%@ Page language="c#" codebehind="default.aspx.cs"
inherits="xmlportal.read" autoeventwireup="false"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>.....</HEAD>
<BODY>......</BODY>
</HTML>

--------------------------------------------------------------
Now, here's my problem:-
I want to change the ContentType of this page to "text/Xml" based on a
condition in an ascx.cs codebehind.......i tried doing it with
Page.ContentType="Text/Xml".....but got an error.....as it could NOT display
xml using the given stylesheet.

Please suggest a way in which I could REMOVE/DEACTIVATE all the
<DOCTYPE>...<HTML> elements (override them) and display the xml on the page
instead by using the xml Page CONTENT TYPE.

Thanks a lot.
Andy
IESL, MIT
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
base on your condition, try this:
this.Response.ContentType="Text/Xml";

this.Response.Write("<xml></xml>");

this.Response.End();

Tu,

"andy" <an**@mit.edu> wrote in message
news:uA**************@TK2MSFTNGP11.phx.gbl...
I have user controls(.ascx) programmed to function as modules on the same
page - default.aspx.
As you would be well aware, default.aspx has the normal html stuff:-
<%@ Page language="c#" codebehind="default.aspx.cs"
inherits="xmlportal.read" autoeventwireup="false"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>.....</HEAD>
<BODY>......</BODY>
</HTML>

--------------------------------------------------------------
Now, here's my problem:-
I want to change the ContentType of this page to "text/Xml" based on a
condition in an ascx.cs codebehind.......i tried doing it with
Page.ContentType="Text/Xml".....but got an error.....as it could NOT display xml using the given stylesheet.

Please suggest a way in which I could REMOVE/DEACTIVATE all the
<DOCTYPE>...<HTML> elements (override them) and display the xml on the page instead by using the xml Page CONTENT TYPE.

Thanks a lot.
Andy
IESL, MIT

Nov 13 '05 #2

P: n/a
with single xml tag like <xml></xml>, IE only display <xml/>, open source
and you will see your full xml tag
put more xml tags and try again.

Tu,
"andy" <an**@mit.edu> wrote in message
news:#4**************@TK2MSFTNGP11.phx.gbl...
Hi,
I tried ur suggestion but ran into the same problems again......i have the
normal html tags in my web form. I also added a button, which when clicked
would raise the event button_click and the page's content type should change and i should be able to display the xml as you had suggested.
this.Response.ContentType="text/xml";

this.Response.Write("<xml></xml>);

this.Response.End();

GENERATED the following output:

<xml />

Please suggest ahead. I would ideally like to render a
System.Web.UI.WebControl.Xml control to the page on changing the content
type to text/xml........this xml control gets formed alright in a different web form. But, I want to be able to display it on the same page.

Thanks a ton.

Andy

"Hoang Anh Tu" <an***@hotmail.com> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
base on your condition, try this:
this.Response.ContentType="Text/Xml";

this.Response.Write("<xml></xml>");

this.Response.End();

Tu,

"andy" <an**@mit.edu> wrote in message
news:uA**************@TK2MSFTNGP11.phx.gbl...
I have user controls(.ascx) programmed to function as modules on the same page - default.aspx.
As you would be well aware, default.aspx has the normal html stuff:-
<%@ Page language="c#" codebehind="default.aspx.cs"
inherits="xmlportal.read" autoeventwireup="false"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>.....</HEAD>
<BODY>......</BODY>
</HTML>

--------------------------------------------------------------
Now, here's my problem:-
I want to change the ContentType of this page to "text/Xml" based on a
condition in an ascx.cs codebehind.......i tried doing it with
Page.ContentType="Text/Xml".....but got an error.....as it could NOT

display
xml using the given stylesheet.

Please suggest a way in which I could REMOVE/DEACTIVATE all the
<DOCTYPE>...<HTML> elements (override them) and display the xml on the

page
instead by using the xml Page CONTENT TYPE.

Thanks a lot.
Andy
IESL, MIT



Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.