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

pass the control value from one web form to another form

P: n/a
tom
Hi Experts,

I want to pass the selectedDate value from my calender
form to another web form or a web user control. Could you
please show me how to do this?

Thanks in advance.

Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Tom,

There are a number of choices to do so.

Depending on your needs, you could use Server.Transfer or Response.Redirect
and the query string.

To use the query string

Response.Redirect("pagetwo.aspx?date=" & selectedDate.ToString)

Then on page two:

Dim Date As Date = CType(Request.Querystring.Item("date"), Date)

If you want to use Server.Transfer (Which would be more suited if a number
of variables need to be passed to the second page.) I suggest reading up on
it a bit more. It's fairly easy to do, but can be confusing for the user
because they are moved to page two but their browser's address bar will
still display the first page's url.

If you want some quick code samples I have some in the code library of my
web site: www.aboutfortunate.com. Just use the search box in the code
library area and input: "Server.Transfer".

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"tom" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
Hi Experts,

I want to pass the selectedDate value from my calender
form to another web form or a web user control. Could you
please show me how to do this?

Thanks in advance.

Nov 17 '05 #2

P: n/a
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetjunkies.com/tutoria...tutorialid=600

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"tom" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
Hi Experts,

I want to pass the selectedDate value from my calender
form to another web form or a web user control. Could you
please show me how to do this?

Thanks in advance.

Nov 17 '05 #3

P: n/a
tom
Hi Steve and S. Justin,

Thank you very much for your responses. I'm sorry that I
didn't explain my problem more clearly on my previous
mail. My problem is a different situation. On my page one
there is textbox and the page two only contains a calendar
control. I need to open page one first and click a button
on page one will open the page two. After user selected a
date from the calendar the page two will close and the
date should be shown on the page one's textbox. I'm
struggling with how to pass value back to page one when
the page one is already opened and update page one's data?

Please help me!
Thanks in advance.
-----Original Message-----
Here's a nice, simple way to pass values from one page to another:(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items ("myParameter"),Integer)
Of course there are a number of ways to pass values from one page toanother, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.You'll have to decide which technique is best for your application.Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/is...04/ASPNETUserS tate/default.aspx
http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetjunkies.com/tutoria...tutorialid=600

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able- consulting.com
"tom" <an*******@discussions.microsoft.com> wrote in messagenews:00****************************@phx.gbl...
Hi Experts,

I want to pass the selectedDate value from my calender
form to another web form or a web user control. Could you please show me how to do this?

Thanks in advance.

.

Nov 17 '05 #4

P: n/a
Tom,

I think this article is just what you need:

http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=614

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"tom" <an*******@discussions.microsoft.com> wrote in message
news:0e****************************@phx.gbl...
Hi Steve and S. Justin,

Thank you very much for your responses. I'm sorry that I
didn't explain my problem more clearly on my previous
mail. My problem is a different situation. On my page one
there is textbox and the page two only contains a calendar
control. I need to open page one first and click a button
on page one will open the page two. After user selected a
date from the calendar the page two will close and the
date should be shown on the page one's textbox. I'm
struggling with how to pass value back to page one when
the page one is already opened and update page one's data?

Please help me!
Thanks in advance.
-----Original Message-----
Here's a nice, simple way to pass values from one page to

another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items

("myParameter"),Integer)

Of course there are a number of ways to pass values from

one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database

between each page, etc.
You'll have to decide which technique is best for your

application.
Here are several good articles on the subject to help you

decide.
http://msdn.microsoft.com/msdnmag/is...04/ASPNETUserS

tate/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetjunkies.com/tutoria...tutorialid=600

http://www.dotnetbips.com/displayarticle.aspx?id=79

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-

consulting.com

"tom" <an*******@discussions.microsoft.com> wrote in

message
news:00****************************@phx.gbl...
Hi Experts,

I want to pass the selectedDate value from my calender
form to another web form or a web user control. Could you please show me how to do this?

Thanks in advance.

.

Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.