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

Retrieve Values During Insert Command

1 Answer 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James Legan
Top achievements
Rank 1
James Legan asked on 12 Nov 2008, 08:20 PM

I have a RadGrid on a page that the auto-insert, update and delete just is not going to work for me based on multiple tables that need to be touched as a result of a single event against the LinqDataSource.

I have been trying for the better part of the afternoon to handle this programatically.

The handler has been created and I can get into it, but in exploring the object, I cannot seem to retrieve the values that I am inserting when clicking on it.

 

 

protected void rgLocations_InsertCommand(object source, GridCommandEventArgs e)

 

{

 

GridEditableItem item = (GridEditableItem)e.Item;

 

}

I am trying to retrieve a string from the textbox on the auto-generated insert form and cannot seem to find the value anywhere.

How can I get the values from these forms?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Nov 2008, 07:21 AM
Hello James,

You can try out the following code to access an item in the InsertForm on the Insert command.
aspx:
<telerik:RadGrid ID="RadGrid2" AutoGenerateColumns="false" runat="server"  OnInsertCommand="RadGrid2_InsertCommand">            
  <MasterTableView EditMode="EditForms" CommandItemDisplay="Top" > 
      <Columns> 
          <telerik:GridBoundColumn DataField="ProductName" HeaderText="ProductName" UniqueName="ProductName" ></telerik:GridBoundColumn> 
          .... 

cs:
protected void RadGrid2_InsertCommand(object source, GridCommandEventArgs e) 
    { 
        GridEditFormInsertItem formItem = (GridEditFormInsertItem)e.Item; 
        TextBox txtBx = (TextBox)formItem["ProductName"].Controls[0]; 
    } 

Thanks
Princy.
Tags
Grid
Asked by
James Legan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or