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

Refer to a newly added row to radgrid outside radgrid event

3 Answers 24 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
riya
Top achievements
Rank 1
riya asked on 09 Mar 2015, 10:57 PM
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!

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 12 Mar 2015, 02:23 PM
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.

 
0
riya
Top achievements
Rank 1
answered on 12 Mar 2015, 03:48 PM
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.



0
Accepted
Maria Ilieva
Telerik team
answered on 17 Mar 2015, 01:40 PM
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.

 
Tags
Ajax
Asked by
riya
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
riya
Top achievements
Rank 1
Share this question
or