3 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 05 Feb 2013, 10:24 AM
Hi,
Try the following code to achieve your scenario.
C#:
JS:
Thanks,
Princy
Try the following code to achieve your scenario.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem item = (GridEditFormItem)e.Item;
RadDatePicker pkr1 = (RadDatePicker)item.FindControl(
"RadDatePicker1"
);
RadGrid1.Controls.Add(
new
LiteralControl(
"<script type='text/javascript'>window['pkr'] = '"
+ pkr1.ClientID +
"';</script>"
));
}
}
$(document).ready(
function
() {
var
pkr = $find(window[
'pkr'
]);
pkr.get_dateInput().focus();
});
Thanks,
Princy
0

Anzar
Top achievements
Rank 2
answered on 05 Feb 2013, 10:47 AM
Hi Princy,
This is not working. Please provide another solution.
Thanks & Regards
Anzar.M
Software Engineer
SBN // Technologics
Ernakulam.
This is not working. Please provide another solution.
Thanks & Regards
Anzar.M
Software Engineer
SBN // Technologics
Ernakulam.
0
Hello Anzar,
The RadDatePicker is a special case because it has two editor control and you could not call just the focus() function. You need to be more specific which element you want to focus.
Please check out the attached web site which demonstrates two approaches, one to show directly the RadDatePicker popup so the user is able to choose directly the date. And in the commented section you could use the code to focus the Dateinput so the user is able to type the date by itself.
You can use the following topic to access the generated picker in edit mode:
( Section Accessing controls in edit/insert mode )
http://www.telerik.com/help/aspnet-ajax/grid-accessing-cells-and-rows.html
I hope this helps. Please give it a try and let me know about the result.
All the best,
Eyup
the Telerik team
The RadDatePicker is a special case because it has two editor control and you could not call just the focus() function. You need to be more specific which element you want to focus.
Please check out the attached web site which demonstrates two approaches, one to show directly the RadDatePicker popup so the user is able to choose directly the date. And in the commented section you could use the code to focus the Dateinput so the user is able to type the date by itself.
You can use the following topic to access the generated picker in edit mode:
( Section Accessing controls in edit/insert mode )
http://www.telerik.com/help/aspnet-ajax/grid-accessing-cells-and-rows.html
I hope this helps. Please give it a try and let me know about the result.
All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.