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

How do you start RadDataForm in insert mode on page load

1 Answer 199 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 17 Sep 2015, 09:13 PM

I've seen this question addressed as a part of another thread  (http://www.telerik.com/forums/begin-in-edit) but I am not able to make this work.   I have a page with a RadDataForm that has an ItemTemplate, and InsertItemTemplate defined.  The RadDataForm is connected to a SQLDataSource via the DataSourceID property.  I tried using the PreRender event as follows to start the RadDataForm in insert mode:

       protected void ResourceDataForm_PreRender(object sender, EventArgs e) {
         if (!Page.IsPostBack) {
            (sender as RadDataForm).IsItemInserted=true;
            (sender as RadDataForm).Rebind();
         }

The page loads, but my insert template is not showing.  Actually, there is nothing that is showing from the RadDataForm.   If I load the page so that a record is displayed in the ItemTemplate, then I can successfully insert a new record using a RadButton that has a CommandName property of "InitInsert".

Any thoughts on what I'm doing wrong ?

 

Thanks -- Jeff Gaiche

 

 

 

1 Answer, 1 is accepted

Sort by
0
Jeff
Top achievements
Rank 1
answered on 17 Sep 2015, 10:27 PM
I found the reason that this was not working.   I needed to pass in a parameter in my HTTP request that matched the QueryStringParameter specification for the select in my SQLDataSource.   Once I did that, it worked as I expected.
Tags
DataForm
Asked by
Jeff
Top achievements
Rank 1
Answers by
Jeff
Top achievements
Rank 1
Share this question
or