Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing data from a web form to another web form

Status
Not open for further replies.

vanisudha2000

Programmer
Joined
May 11, 2006
Messages
21
Location
US
Hello,
I am new to ASP.Net, I am building an web application in which I have a webpage which has a button on it , on click of the button how can i get a web form on which I can place some controls like text , label and another submitt button.
On click on the submitt button, the data entered in the webform should be shown on the first web page, I have tried a lot doing server.transfer, but could not get the values of the webform displayed on the first web page.
Could any of you please help in with the code.

Thanks in advance.
 
I am confused on what you are trying to do. Please explain more clearly.
 
The web application has source page and destination page.
There is ADD button on the source page , on click of that ADD button, the destination page comes up with some controls on it for the input like text fields. This destination page after all the data is inputed into the fields , there is a button called SUBMITT on this destination page. on click of the submitt button on the destination page , the data in the controls should be displayed on the source page .

The data from the destination page should be displayed on the source page on click of the submitt button.

Hope I am clear.
 
why have two pages? unless I am missing something here. it seems like to me all your doing is adding records in two seperate forms. do you need to seperate forms?

are you going to do an insert on the first form then an update on the second form? I'm not sure on what your trying to do.

 
If i got it:

1. Session vars
or
2. page.previewspage.findcontrol("control_name")
In the 2nd you have to cast it to a control type to retrieve its propertis. In most cases it may be a textbox, optionlist, calendar,etc..

(previewspage exists in .Net1.1, right?)
 
In the first page I have only one "ADD NEW" button and nothing else, onClick event of this button a second page comes up with some text control and a submitt button.
I enter "TEST" in the text control and click Submitt button.
Now this "Test" has to be displayed on the first page.
along with the ADD NEW button.
How many times I click ADDNEW button that many times it has to take me to the second page with the text control and submitt button. and what ever text i enter in the text control and submitt that page, the text has to append the text before displayed on the first page.

I am not able to understand how to display the text in the first page on submitt in the second page.
 
To append (string) use '&='

Have a search also on query strings...
 
OK,

Dim strRedirect As String

strRedirect = "YouPopUp.aspx?YouValue=" & YourControl.Text
Response.Write("<script language='javascript'>" & vbCrLf)
Response.Write("wndcht=window.open('" + strRedirect + "','_new', 'toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,left=0,top=0');")
Response.Write("<" & "/" & "script" & ">" & vbCrLf)

then on load of your popup

YourControl.Text = Request.QueryString("YourValue")

 
where should i put this code, how can i write the same thing in c#.

 
where should i put this code

put the first part on your button click


then on load of your popup

YourControl.Text = Request.QueryString("YourValue")

 
In the first page, on click of button,
public void Button1_Click(object sender, System.EventArgs e)
{
string strRedirect ;
strRedirect = "WebForm2.aspx?YouValue=" + tNameForm1.Text;
Response.Write("<script language='javascript'>");
Response.Write("wndcht=window.open('" + strRedirect + "','_new', 'toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,left=0,top=0');");
Response.Write("< /script >");
}

on the second page, page_load event

private void Page_Load(object sender, System.EventArgs e)
{
txtNameForm2.Text = Request.QueryString("YourValue") ;
}

Iam getting an error saying QueryString denotes a property where as a method was expected.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top