How to assign RadDatePicker value using Request.QueryString

3 posts, 0 answers
  1. Deva Kumar
    Deva Kumar avatar
    12 posts
    Member since:
    Nov 2009

    Posted 16 Nov 2009 Link to this post

    Hi Experts,

    Could you please help us on setting the RadDatePicker Control value on Request.QueryString.

    I am invoking an aspx page on a button click from user control and the datapicker control resides in usercontrol. and this datapicker control value should be set from the aspx page invoked.

    Thanks in advance.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Nov 2009 Link to this post

    Hello Deva Kumar,

    I am not quite sure whether I completely understood your requirement but as far as I understood you want to set the RaDatePicker value from invoked page by passing as url parameter and I guess the button and RadDatePicker are placed in same usercontrol in the first page.

    Here is the code that I tried to set the datepicker value for this scenario.
    invokedpage (second page):
    cs:
     
    Response.Redirect("FirstPage.aspx?date="+DateTime.Now); // going back to first page and passing the date as parameter 

    FirstPage.aspx:
    aspx:
     
    <uc1:WebUserControl ID="WebUserControl1" runat="server" /> 

    cs:
     
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (Request["date"] != null
            { 
                Response.Write(Request.QueryString["date"]); 
                (WebUserControl1.FindControl("RadDatePicker1"as RadDatePicker).SelectedDate = Convert.ToDateTime(Request.QueryString["date"]); 
            } 
        } 
    [RadDatePicker1 is placed in usercontrol with ID 'WebUserControl1' ]



    Feel free to share the comments,
    Shinu.
  3. Deva Kumar
    Deva Kumar avatar
    12 posts
    Member since:
    Nov 2009

    Posted 18 Nov 2009 Link to this post

    Thanks a lot Shinu for your kind help.

    The scenario is like this Shinu.
    1. I have a user control on Page 1 containing the RadDatePicker.
    2. A Button on the same user control on Page 1
    3. On clicking the button - a new aspx page will load containins a list of values in a grid and upon selecting a row in the grid, the date value in the selected row should populate on the Invoked Page 1 - RadDatePicker Control and the new aspx page should close.

    I tried like this. On the second page - using the Request Query String - Invoked a Java Script function which is present in Page 1 (containing the user control) and this Java Script Function will set the RadDatePicker Date using set_SelectedDate client method. Also to this Java Script Function - I will pass the date as parameter. And this worked.

    Once again thanks for your kind help.

    Thank you,
    Deva

Back to Top