Passing Data

Discussion in 'ASP .Net' started by Dot Net Daddy, Aug 14, 2006.

  1. Hello,

    I want to pass the Calendar.SelectedDate to another page. But I dont
    want to do it with either in the QueryString or HiddenField. Is there
    another approach you can come up?

    Thanks in advance.
    Dot Net Daddy, Aug 14, 2006
    #1
    1. Advertising

  2. You can use sessions this is a solution that work on both ASP.NET 1.x and
    ASP.NET 2.0
    the other solution is useing Cross Page Post Back. this will transfer you
    page viewstate to the postback page target.
    You use this by doing the following:
    1)Set the PostBackUrl property of your button to the target Page
    2) in your target Page use PreviousPage to get your control value like this:
    DateTime dtm = (Calendar)PreviousPage.FindControl("Calendar1").SelectedDate;

    make sure that you check for PreviousPage is not NULL before use it.

    Hope this would help
    Regards
    --
    Muhammad Mosa
    Software Engineer & Solution Developer
    MCT/MCSD.NET
    MCTS: .Net 2.0 Web Applications
    MCTS: .Net 2.0 Windows Applications


    "Dot Net Daddy" wrote:

    > Hello,
    >
    > I want to pass the Calendar.SelectedDate to another page. But I dont
    > want to do it with either in the QueryString or HiddenField. Is there
    > another approach you can come up?
    >
    > Thanks in advance.
    >
    >
    =?Utf-8?B?TXVoYW1tYWQgTW9zYQ==?=, Aug 14, 2006
    #2
    1. Advertising

  3. Thank you for your help.

    I first tried to use the 2nd solution, cross page post backs, which
    looked easier to me (since I didnt have any information about
    Sessions), but it didnt work. The part after the FindControl expression
    was not recognized by the VS2005. and since I didnt know what to import
    (Imports System. what?) I made a search and after reading, which
    lasted about 2 minutes, an article about sessions now it works fine.

    this is what I used, in case anyone wonders:

    Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles LinkButton2.Click
    Session.("selectedDate") = Calendar1.SelectedDate
    Response.Redirect(URL as String)
    End Sub


    Muhammad Mosa wrote:
    > You can use sessions this is a solution that work on both ASP.NET 1.x and
    > ASP.NET 2.0
    > the other solution is useing Cross Page Post Back. this will transfer you
    > page viewstate to the postback page target.
    > You use this by doing the following:
    > 1)Set the PostBackUrl property of your button to the target Page
    > 2) in your target Page use PreviousPage to get your control value like this:
    > DateTime dtm = (Calendar)PreviousPage.FindControl("Calendar1").SelectedDate;
    >
    > make sure that you check for PreviousPage is not NULL before use it.
    >
    > Hope this would help
    > Regards
    > --
    > Muhammad Mosa
    > Software Engineer & Solution Developer
    > MCT/MCSD.NET
    > MCTS: .Net 2.0 Web Applications
    > MCTS: .Net 2.0 Windows Applications
    >
    >
    > "Dot Net Daddy" wrote:
    >
    > > Hello,
    > >
    > > I want to pass the Calendar.SelectedDate to another page. But I dont
    > > want to do it with either in the QueryString or HiddenField. Is there
    > > another approach you can come up?
    > >
    > > Thanks in advance.
    > >
    > >
    Dot Net Daddy, Aug 14, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. terry
    Replies:
    1
    Views:
    459
    William F. Robertson, Jr.
    Jul 7, 2003
  2. Victor Bazarov
    Replies:
    25
    Views:
    848
    E. Robert Tisdale
    Mar 23, 2005
  3. pereges
    Replies:
    7
    Views:
    423
    pereges
    Jun 1, 2008
  4. Ramon F Herrera
    Replies:
    8
    Views:
    468
    Pascal J. Bourguignon
    Sep 13, 2009
  5. deadpickle
    Replies:
    1
    Views:
    956
    Jens Thoms Toerring
    Nov 7, 2010
Loading...

Share This Page