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

Submitting a form to a new window in ASP.NET

I have a form that I want to submit to a different page and in a new window.

I have done this using an HTML button and putting a target="_blank"
attribute in the FORM tag. This does give me the results, but I'm unable to
control the size and other properties of this new window.

If I try to takeout the runat=server attribute from the form element and
write a custom javascript function, then my other web controls in the form
(dropdown lists and others) start giving me errors.

What will be a neat and clean solution to do this... Any help?

Thanks in advance.
Jul 21 '05 #1
1 1402

There is no possiblility in ASP.NET 1.x to submit a form to another page
without playing some tricks (you should create your own page class that
inherit Page class). But you can do it fully on client side.
Add an HTML button:

<input type="button" name="submit" value="Submit a Form" onclick="return
submitNew()">

Suppose you have two textboxes on your form, named Text1 and Text2, then
your rendered to HTML form should look like:
<form id="frmMain">
Text1: <input type="text" id="Text1"><br />
Text2: <input type="text" id="Text2"><br />
<input type="button" name="submit" value="Submit a Form" onclick="return
submitNew()">
</form>

And add a simple JavaScript to your page:
<script>
function submitNew() {
window.open("http://somehost.com/SomePage.aspx?Text1=" +
frmMain.Text1.Value + "&Text2=" + frmMain.Text2.Value, "New Window",
"scrollbars=0, height=400, width=600, left=20, top=20");
}
</script>

Gaidar

"mavrick101" <ma********@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
I have a form that I want to submit to a different page and in a new
window.

I have done this using an HTML button and putting a target="_blank"
attribute in the FORM tag. This does give me the results, but I'm unable
to
control the size and other properties of this new window.

If I try to takeout the runat=server attribute from the form element and
write a custom javascript function, then my other web controls in the form
(dropdown lists and others) start giving me errors.

What will be a neat and clean solution to do this... Any help?

Thanks in advance.

Jul 21 '05 #2

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

Similar topics

1
by: Display Name | last post by:
the customer I'm developing a site for uses a canned form-parsing page that allows her to have an email subscription opt-in page add emails to a list she can manage using a link that you point your...
7
by: Marco Alting | last post by:
Hi, I want to use the submit button of a new window to submit the form of the new window (which carries two values to the opener window) and then submit the opener form. Can anyone tell me...
5
by: Don | last post by:
I have a need to submit a form, but don't need the user to click on a button. How do I do this? Is there some way, using JavaScript, to setup a <form> tag to do this? Thanks, Don ----==...
1
by: mavrick101 | last post by:
I have a form that I want to submit to a different page and in a new window. I have done this using an HTML button and putting a target="_blank" attribute in the FORM tag. This does give me the...
1
by: Hello | last post by:
Scenario: A page creates a pop up and that pop up submits a form. Is there a way to detect whether the submitting was successful or not, so true/false could be passed to the parent window?
2
by: varun | last post by:
Hi, I am using goahead webserver...i have a form, in acction attribute i am calling a c function.. after submitting the form i need to close the window and i need to reload the window which...
7
by: FP | last post by:
This should be simple but I just can't seem to figure it out. I have a form with 2 checkboxes in it. Clicking either checkbox runs a js function which opens a new window. The form targets that...
2
by: vikasbatra | last post by:
i m submitting (posting) a form to some external site url . By clicking on submit it opens up new window (target='_blank' set) and my form is submitted there. but if i tries to submit a form using...
1
by: dittu | last post by:
How to close the popup window when submitting the form? I have a sample.jsp. In that page one button is there. when button pressed, open popup window contains one "text box" and one " submit...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.