Passing value from one form to another

M

Mike

Hi,

I need to pass a value from one Web Form to another. In Form #1 I have set up a web control (hyperlink) that in its "Transfer" property contains the name of the Web Form to be loaded. How can I read the listIndex of a Listbox in Form #1 when the Form#2 is loaded?

Thanks

Mike
 
R

Rick Spiewak

You can make a public property on Form #1 which reads it and returns it. Or, why not just pass it as a request item to Form#2?
Hi,

I need to pass a value from one Web Form to another. In Form #1 I have set up a web control (hyperlink) that in its "Transfer" property contains the name of the Web Form to be loaded. How can I read the listIndex of a Listbox in Form #1 when the Form#2 is loaded?

Thanks

Mike
 
E

Eliyahu Goldin

When another form loads, the first one's gone. No public property, nothing. Whatever you want to pass, you should put either into the request or session variables.

Eliyahu
You can make a public property on Form #1 which reads it and returns it. Or, why not just pass it as a request item to Form#2?
Hi,

I need to pass a value from one Web Form to another. In Form #1 I have set up a web control (hyperlink) that in its "Transfer" property contains the name of the Web Form to be loaded. How can I read the listIndex of a Listbox in Form #1 when the Form#2 is loaded?

Thanks

Mike
 
R

Roger Helliwell

Hi,

I need to pass a value from one Web Form to another. In Form #1 I have set up a web control (hyperlink) that in its "Transfer" property contains the name of the Web Form to be loaded. How can I read the listIndex of a Listbox in Form #1 when the Form#2 is loaded?

Why not use Session variables?

Form1:
Session.Add("MyValue", "123");
// load form 2

Form2:
void Page_Load(object sender, System.EventArgs e)
{
string myval = Session["MyValue"].ToString();
}

Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top