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

RadDateTimePicker in layout template firing InitInsert command

2 Answers 36 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Jacek
Top achievements
Rank 1
Jacek asked on 21 Sep 2012, 09:25 AM
Hi,

I would like the RadDateTimePicker located in LayoutTemplate to fire InitInsert command.
The problem is, RadDateTimePicker does not have CommandName property (and CommandArguments), so the only way to do that would be to fire command from SelectedDateChanged.

I understand that RadListViewDataItem can use FireCommandEvent method, but how to get RadListViewDataItem when the RadListVIew is empty?

In other words, how to make the following to start working as intended above

protected void myDatePicker_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
        {
            RadListViewDataItem r = new RadListViewDataItem(myRadListView, 0);
            r.FireCommandEvent("InitInsert", String.Empty);
        }

Thanks,
Jacek

2 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 25 Sep 2012, 11:52 AM
Hello Jacek,

You could use the following method:
RadListView1.ShowInsertItem();
As demonstrated in the following demo:
http://demos.telerik.com/aspnet-ajax/listview/examples/templates/editinserttemplates/defaultcs.aspx

An alternative approach would be to use a client-side fireCommand:
http://www.telerik.com/help/aspnet-ajax/listview-firecommand.html

That should do the trick. Please give it a try and let me know about the result.

Kind regards,
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.
0
Jacek
Top achievements
Rank 1
answered on 25 Sep 2012, 12:28 PM
Great, thanks!
Tags
ListView
Asked by
Jacek
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Jacek
Top achievements
Rank 1
Share this question
or