By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,219 Members | 1,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,219 IT Pros & Developers. It's quick & easy.

Data transfering with few WebForms

P: n/a
Hi!

I have a little problem an qeustion.

In .NET Windows Forms I can do something like that:
- i have forms - Form1 Form2, on first form i have TextBox1 control on 2nd
form I have Button1 control
- on second Form i can acces data from Form1 like that:

for example: MessageBox.Show(Form1.TextBox1.Text);

That's simply and logical.

But Can i do something like that in WebForms?

I have problems with transfering data between to WebForms (2 *.aspx pages) -
i can't have acces to WebForm2.TextBox1 (example) from any method
implemented in WebForm1 - namespace is the same and that is not so logical
for me. That way of transferig data could be very easy to use and useful but
i don't know is that possible? And if is in what way?

Of course i can use Page.FORM collection but this is not so easy.

If you can write me how i would acces control from one page on the other i
will be very thankfull :)

I have programmed a lot in PHP, Java and asp.net is something totally new
for me.

ps. Sorry for not sa good english :)

--
Pozdrawiam serdecznie!

--
Piotr Karwatka
-- pi************@aktywni.pl, pi***@amigo.pop.pl
-- http://amigo.pop.pl
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Piotr,
- on second Form i can acces data from Form1 like that:

for example: MessageBox.Show(Form1.TextBox1.Text);

That's simply and logical.
Not as simple and logical as you think. The only way that one Windows Form
can "see" data in another Windows Form is if they are both memory-resident
in the same application at the same time. If they are 2 disconnected Windows
Forms executables, they must message each other via the OS or network.

A web application runs in HTTP context, which means that while the web
application memory is shared among all pages (WebForms), the pages
themselves don't co-exists in the same memory space at the same time. A
WebForm exists from the time an HTTP Request is received until the time that
the Response is sent. This means that WebForms must communicate in the same
way that separate Windows Form processes must communicate: via the server or
network.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Piotr Karwatka" <pi************@amigo.pop.pl> wrote in message
news:cl**********@nemesis.news.tpi.pl... Hi!

I have a little problem an qeustion.

In .NET Windows Forms I can do something like that:
- i have forms - Form1 Form2, on first form i have TextBox1 control on 2nd
form I have Button1 control
- on second Form i can acces data from Form1 like that:

for example: MessageBox.Show(Form1.TextBox1.Text);

That's simply and logical.

But Can i do something like that in WebForms?

I have problems with transfering data between to WebForms (2 *.aspx pages) - i can't have acces to WebForm2.TextBox1 (example) from any method
implemented in WebForm1 - namespace is the same and that is not so logical
for me. That way of transferig data could be very easy to use and useful but i don't know is that possible? And if is in what way?

Of course i can use Page.FORM collection but this is not so easy.

If you can write me how i would acces control from one page on the other i
will be very thankfull :)

I have programmed a lot in PHP, Java and asp.net is something totally new
for me.

ps. Sorry for not sa good english :)

--
Pozdrawiam serdecznie!

--
Piotr Karwatka
-- pi************@aktywni.pl, pi***@amigo.pop.pl
-- http://amigo.pop.pl

Nov 18 '05 #2

P: n/a
You probably want to look at something like server.transfer which will allow
you to pass information between webforms. alternatively look at the caching,
session, state options available in asp.net

"Piotr Karwatka" wrote:
Hi!

I have a little problem an qeustion.

In .NET Windows Forms I can do something like that:
- i have forms - Form1 Form2, on first form i have TextBox1 control on 2nd
form I have Button1 control
- on second Form i can acces data from Form1 like that:

for example: MessageBox.Show(Form1.TextBox1.Text);

That's simply and logical.

But Can i do something like that in WebForms?

I have problems with transfering data between to WebForms (2 *.aspx pages) -
i can't have acces to WebForm2.TextBox1 (example) from any method
implemented in WebForm1 - namespace is the same and that is not so logical
for me. That way of transferig data could be very easy to use and useful but
i don't know is that possible? And if is in what way?

Of course i can use Page.FORM collection but this is not so easy.

If you can write me how i would acces control from one page on the other i
will be very thankfull :)

I have programmed a lot in PHP, Java and asp.net is something totally new
for me.

ps. Sorry for not sa good english :)

--
Pozdrawiam serdecznie!

--
Piotr Karwatka
-- pi************@aktywni.pl, pi***@amigo.pop.pl
-- http://amigo.pop.pl

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.