Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > pass the control value from one web form to another form

Reply
Thread Tools

pass the control value from one web form to another form

 
 
tom
Guest
Posts: n/a
 
      11-12-2003
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.

 
Reply With Quote
 
 
 
 
S. Justin Gengo
Guest
Posts: n/a
 
      11-12-2003
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" <> wrote in message
news:00d201c3a947$75660be0$...
> 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.
>



 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      11-12-2003
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" <> wrote in message
news:00d201c3a947$75660be0$...
> 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.
>



 
Reply With Quote
 
tom
Guest
Posts: n/a
 
      11-13-2003
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" <> wrote in

message
>news:00d201c3a947$75660be0$...
>> 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.
>>

>
>
>.
>

 
Reply With Quote
 
S. Justin Gengo
Guest
Posts: n/a
 
      11-13-2003
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" <> wrote in message
news:0e5401c3a9ee$cd69a7f0$...
> 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" <> wrote in

> message
> >news:00d201c3a947$75660be0$...
> >> 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.
> >>

> >
> >
> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass value from one form to another form. Jay ASP .Net 5 06-29-2010 06:12 PM
How to force a load of one control from another control on another form? et ASP .Net 1 06-29-2005 07:45 PM
How to force a load of one control from another control on another form? et ASP .Net Datagrid Control 0 06-29-2005 06:05 PM
Another basic question: How to call and show one Web Form from another Web Form? Rob R. Ainscough ASP .Net Web Controls 3 06-14-2005 03:56 PM
accessing the web user control's control from a web page and set a value from another web page Reny J Joseph Thuthikattu ASP .Net 1 12-30-2004 12:21 PM



Advertisments