How do you start RadDataForm in insert mode on page load

2 posts, 0 answers
  1. Jeff
    Jeff avatar
    11 posts
    Member since:
    Mar 2013

    Posted 17 Sep 2015 Link to this post

    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

     

     

     

  2. Jeff
    Jeff avatar
    11 posts
    Member since:
    Mar 2013

    Posted 17 Sep 2015 in reply to Jeff Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top