473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

change web form content type programmatically

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 17 '05 #1
2 6377
I had to write a similar page, but my page actually handed back a gif image.
If the page is always xml, just remove all the html from the page and remove
your controls and everything. In the page load method set your content type
just like you were, then override the render method and in the render method
write the xml to the response stream directly. If you have any questions
about that email me.

Hope that helps,
David
"andy" <an**@mit.edu> wrote in message
news:uN*************@TK2MSFTNGP10.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 17 '05 #2
I had to write a similar page, but my page actually handed back a gif image.
If the page is always xml, just remove all the html from the page and remove
your controls and everything. In the page load method set your content type
just like you were, then override the render method and in the render method
write the xml to the response stream directly. If you have any questions
about that email me.

Hope that helps,
David
"andy" <an**@mit.edu> wrote in message
news:uN*************@TK2MSFTNGP10.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 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Reply Via Newsgroup | last post by:
Folks, Say I have a table, ten columns, ten rows - Each with a word in it. I want to change the values of some/all of the cells in the table via a hyperlink. How do I reference each cell and...
8
by: deko | last post by:
I'm trying to find a way to set form/control properties programmatically. In a nut shell: 1. Open a database 2. Open a form in design view 3. Do something like this: For Each prp In...
0
by: andy | last post by:
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#"...
12
by: TheOne | last post by:
In Asp.net web form under form tag there is action field that I am point to some other page, and not to same web form. When I run this page it is always pointing to itself. How do I get around...
6
by: Ben | last post by:
Hi I need to design a form that I can programmatically post using this code from a VB .NET Windows Application: Dim web As New System.Net.WebClient() web.Headers.Add("Content-Type",...
3
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - I have window.status="Moomin"; why doesn't the statusbar change?...
2
by: Radu | last post by:
Hi, I have a "select" control named "cboSelectScorecardType", defined as <select id="cboSelectScorecardType" size="1" runat="server"> </select> which shows a list of files on my drive. It...
5
by: thatcollegeguy | last post by:
Below are my 3php and 2js files. I create a table using ajax/php and then want to change the values in the tables add(+ number for teamid) id's for each specific td in the table. I don't know...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.