473,382 Members | 1,814 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,382 software developers and data experts.

Post using Response.Write

Hello all,

I'm trying to post to another page from asp.net and direct the user
there. I've looked through the group and found a lot of information.
The following code may work well for what I'm doing.

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

** Response.Write("<!-- Include File='Example.aspx' -->")
Response.Write("<form name='Form2' action='UrlHere' method='POST' >")
** Response.Write("<% Example() %>")
Response.Write("<INPUT type='hidden' name='none' value='none'>")
Response.Write("</form>")
Response.Write("<script>")
Response.Write("document.Form2.Submit();")
Response.Write("</script>")

End Sub

The problem I'm having is trying to implement the include file and run
functions from it. If I remove the code for the function and the
include file (labeled with **) the post will work, but without them it
isn't working the way I need it to.

Does anyone know of a way that I can implement this include file into
the following code and run fuctions from it?

Thanks

Jul 10 '06 #1
3 8823
You can not use include files that are aspx pages in ASP.Net. The reason is
that the pages are compiled and run before being sent to the client.

Read this article, it will tell you how to accomplish what you are asking.

http://support.microsoft.com/default...b;en-us;306575

--
-Demetri
"Jer425" wrote:
Hello all,

I'm trying to post to another page from asp.net and direct the user
there. I've looked through the group and found a lot of information.
The following code may work well for what I'm doing.

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

** Response.Write("<!-- Include File='Example.aspx' -->")
Response.Write("<form name='Form2' action='UrlHere' method='POST' >")
** Response.Write("<% Example() %>")
Response.Write("<INPUT type='hidden' name='none' value='none'>")
Response.Write("</form>")
Response.Write("<script>")
Response.Write("document.Form2.Submit();")
Response.Write("</script>")

End Sub

The problem I'm having is trying to implement the include file and run
functions from it. If I remove the code for the function and the
include file (labeled with **) the post will work, but without them it
isn't working the way I need it to.

Does anyone know of a way that I can implement this include file into
the following code and run fuctions from it?

Thanks

Jul 10 '06 #2
Thank you for the response.

When I use the code below in html, I'm able to run the function from
the Example.aspx include file. Only when moving it to the code behind
with response.write is when I get a problem as I mentioned above.

<FORM id="Form2" action="UrlHere" method="post">

<!-- #Include File="Example.aspx" -->
<% Example() %>
<INPUT type='hidden' name='none' value='none'>
<INPUT TYPE="submit" VALUE="Submit" NAME="Submit">

</FORM>

Jul 10 '06 #3
That is because you are trying to use Response.Write as a time machine. ;)

The SSI (server side include) is performed before the ASP.NET code is
compiled. That means that once the code is running, it's too late to
make an include.

Also, you are trying to write ASP.NET code to the page to have it
executed. As the code of the page has already been compiled, it's too
late to add more code.

Whatever you write to the page using Response.Write will just end up in
the html code of the page.
Jer425 wrote:
Thank you for the response.

When I use the code below in html, I'm able to run the function from
the Example.aspx include file. Only when moving it to the code behind
with response.write is when I get a problem as I mentioned above.

<FORM id="Form2" action="UrlHere" method="post">

<!-- #Include File="Example.aspx" -->
<% Example() %>
<INPUT type='hidden' name='none' value='none'>
<INPUT TYPE="submit" VALUE="Submit" NAME="Submit">

</FORM>
Jul 10 '06 #4

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

Similar topics

5
by: eddie wang | last post by:
How to convert the following html to asp page using response.write? Thanks. <td align="right"><Font class=content4><%=ars.Fields("REVENUE")%></td> *** Sent via Developersdex...
4
by: Nevyn Twyll | last post by:
Is there any way I can use a code-behind event (like a btn_Click event) to write some javascript into the Response? I was thinking of using Response.Write() to write the following code into the...
3
by: PK9 | last post by:
I'm having some issues with using a Response.Write or the shortcut ( <%= ...) from within a label control. I cannot do this in the code behind, I need to do it here at runtime. I have a public...
3
by: Coby Herd | last post by:
I cannot find any information on how to insert an image into a block of text and have the text wrap around the image. All if the text and graphics in the client's site are being pulled from the...
14
by: Piotrek | last post by:
Hi all. I have a web app, in which I use frames. My main frameset consists of three inner frames. When some button is pressed in frame A, then content of frame B is reloaded. I am using such...
1
by: ChristopherABurns | last post by:
I have a very simple code snippet here: private void Page_Load(object sender, System.EventArgs e) { string filePath = Server.MapPath("\\Transcriber\\TranscriberTest\\"); string fileName =...
3
by: Dave Keen | last post by:
Hi all. Hope you can help me. This should be easy but I can't make this work. In brief I am building a page of thumbnails using images held in a SQLServer 2000 database. I do this by creating...
7
by: Jim in Arizona | last post by:
I'm brand new at ajax. In fact, about 20 minutes ago was the first time I got it to work. The problem I'm having on another page did not work, however. I'm running into the following error: ...
5
by: satyabhaskar | last post by:
hi all, In my web page i have created radio buttons dynamically on to the page .....following is my code string Course, Semester, Section; int rowsCount; string con =...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.