Refer to a newly added row to radgrid outside radgrid event

4 posts, 1 answers
  1. riya
    riya avatar
    3 posts
    Member since:
    Mar 2015

    Posted 09 Mar 2015 Link to this post

    I am trying to access to a new added row in radgrid which is not committed yet. Just a new row is added and user enters data. Onclick on a link on this row a new method is being invoked which updates two fields in this particular row. So when user actually click on the insert button the updated fields are saved to the db along with user entry. So I want to know how refer to this newly added row in the radgrid which is not saved yet.

    Thanks!
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 12 Mar 2015 Link to this post

    Hello,

    You can extract values from current insert/update item as shown below:
    protected void YOURGRID_InsertCommand(object source, GridCommandEventArgs e) 
        
            Hashtable values = new Hashtable(); 
            ((GridEditableItem)e.Item).ExtractValues(values); 
            columnXXXvalue = values["Column Name"]; 
        }

    You can find more examples here.

    I hope this helps.

    Regards,
    Maria Ilieva
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. riya
    riya avatar
    3 posts
    Member since:
    Mar 2015

    Posted 12 Mar 2015 in reply to Maria Ilieva Link to this post

    This is what I am looking for:
     I have the radgrid in insert mode. User enters data and does not click update. They click on a link called Name Lookup which calls a modal popup. This pop up returns a person object to a method outside the radgrid event say Method resultsFromPopUp.

    I want to refer to this new row that's getting inserted and populate it with the person first name and last name which has to happen in the resultsFromPopUp method. Please advise how to refer to this new row from resultsFromPopUp. Mygrid_Insertcommand won't help me.



  5. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 17 Mar 2015 Link to this post

    Hello Riya,


    If the "resultsFromPopUp " is a Page method on success of this method you can access the insert item on the client like this:

    var editForm = $find("<%=RadGrid1.ClientID%>").get_masterTableView().get_insertItem();
    var txt = $telerik.findElement(editForm, "TextBox1");
    alert(txt.value);

    I hope this helps.

    Regards,
    Maria Ilieva
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top