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

Get/Set RadDatePicker Selected Date Client-Side

2 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 29 Sep 2014, 05:44 PM
Hi,

I am trying to update a read-only GridDateTimeColumn field in a Rad Grid while the item is being edited. The computation to do the update is to calculate the calendar date based off the Julian date in a RadNumeric TextBox. I am able to get the two controls client ID's by using the following code server-side on the Item Created event:

RadNumericTextBox rnumtxt1 = item.FindControl("gtbJulianDate") as RadNumericTextBox;
RadDatePicker picker = (RadDatePicker)item["GroundDate"].Controls[0] as RadDatePicker;

rnumtxt1.Attributes.Add("onBlur", "return updateGround('" + rnumtxt1.ClientID + "','" + picker.ClientID + "')");

The javascript function finds the RadNumeric TextBox just fine and can perform the computation, but when I set the picker field on the client-side, it always ends up being null. I use the following code to set the variables:

var julianTxtBox = $find(txt1);    
var groundDate = $find(txt2);

Can you please help by letting me know why that is not working or if there are any other ways to access that field and set it on the client?

Thanks,

Joe

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 02 Oct 2014, 11:08 AM
Hello Joe,

Please use the logic suggested in the following article to pass arguments to the client-side event handlers of Telerik controls:
http://www.telerik.com/forums/passing-arguments-to-client-events#QkAxV87iOUalEx4wNaumeA

In addition, I'm sending a sample RadGrid web site to demonstrate a basic implementation.

Hope this helps. Please make the suggested modification and let me know about the result.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Joe
Top achievements
Rank 1
answered on 02 Oct 2014, 04:10 PM
Eyup,

Thanks. Finally got it resolved using the same logic more or less. Appreciate your help and time.

- Joe
Tags
Grid
Asked by
Joe
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Joe
Top achievements
Rank 1
Share this question
or