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

[Solved] Default values in FormTemplate

3 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Torben
Top achievements
Rank 1
Torben asked on 22 Oct 2009, 07:21 AM

Hi

I have i a Radgrid a formtemplate that includes 3 Dateinput fields all surrended by RadDateTimePicker

By inserting new rows:
The first datefield should be defaulted with a parameter commig from a  globdate = Request["globdate"].

The second and third datefield should after modify from datafield1 be defaulted with a value depending an this modified value.

how do I achive this with ClientEvents code ?.

 

 

 

thx
Torben

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 27 Oct 2009, 11:58 AM
Hello Torben,

By "ClientEvents code" I believe you mean accessing and setting these values on the client when the edit form loads. If this is the case, then, we would suggest that you use the controls' client-side OnLoad events to set their values:

<telerik:RadDatePicker ID="RadDatePicker1" runat="server">
    <DateInput>
        <ClientEvents OnLoad="pickerLoad" />
    </DateInput>
</telerik:RadDatePicker>

function pickerLoad(sender, args)
{
    var d = new Date();
    sender.set_value(d.toDateString());
}


All the best,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Torben
Top achievements
Rank 1
answered on 06 Nov 2009, 10:08 AM
Thx for the response
This partly solves the problem, but only by insert new record, by modifying, the date is always new initiated. I need to find a way to test if the the date-field (From Date) already has a value. I also need to find a way to default a value to another (To Date) date-field based on what the users typed in the From Date field.

Thx
Torben 
0
Veli
Telerik team
answered on 10 Nov 2009, 07:16 AM
Hi Torben,

Here is a reference to the RadDatePicker client-side API:

RadDatePicker Client Object

You can also go through the other articles in the section, to get yourself acquainted with the client API of the control. For your scenario, I believe you can use the same client-side OnLoad event handler that we started with.

All the best,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Torben
Top achievements
Rank 1
Answers by
Veli
Telerik team
Torben
Top achievements
Rank 1
Share this question
or