473,809 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1429

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("ht tp://somehost.com/SomePage.aspx?T ext1=" +
frmMain.Text1.V alue + "&Text2=" + frmMain.Text2.V alue, "New Window",
"scrollbars =0, height=400, width=600, left=20, top=20");
}
</script>

Gaidar

"mavrick101 " <ma********@dis cussions.micros oft.com> wrote in message
news:19******** *************** ***********@mic rosoft.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
3793
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 HTML form to. the actual form-parsing page resides on a server that's uneditable to me since it sits on an inaccessible server. my problem is more irritating than anything; everything double-submits.. when you submit the form, I've forced a...
7
12458
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 how to do this?
5
1918
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 ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =---
1
347
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 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...
1
1532
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
3840
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 navigated to this window..... i used this javasript ....... function doUnLoad()
7
1683
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 new window. How can I pass a hidden value letting the new window know which checkbox was clicked? Below is the code I'm currently using: function JSCheckbox(WhichForm) { window.open('', "CheckboxWindow", 'height=1,width=1');
2
3619
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 java script by using document.form_name.submit; then new window is opened but i m not getting results. example: <meta http-equiv="refresh" content="10" /> <script language="javascript"> function submit_form() { document.form1.submit();
1
3242
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 button". when "submit" button pressed, call the "servlet" in this popup window and then close the "popup" window. <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var X = 200; // change the # at the left for a fixed X co-ordinate to accommodate...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10637
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10379
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9199
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.