This is a migrated thread and some comments may be shown as answers.

How to assign RadDatePicker value using Request.QueryString

2 Answers 136 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Deva Kumar
Top achievements
Rank 1
Deva Kumar asked on 16 Nov 2009, 07:47 PM
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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Nov 2009, 08:01 AM
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.
0
Deva Kumar
Top achievements
Rank 1
answered on 18 Nov 2009, 07:38 PM
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

Tags
Calendar
Asked by
Deva Kumar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Deva Kumar
Top achievements
Rank 1
Share this question
or