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

unable to find postback data from RadGrid insert popup.

1 Answer 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 20 Mar 2012, 09:41 PM
I am unable to locate how to access data from a GridEditMode.PopUp in your object model. In my RadGrid1_ItemCommand I have code to show the popup and this works(see below) but when I click on the insert button at the bottom of the popup the RadGrid1_ItemCommand fires again but I am unable to find the data I just entered into the popup.  I have looked on source, on RadGrid1, on e.item. etc...   Can you tell me where in your object model the popup data is stored?  The only example like this I could find was using AllowAutomaticInserts="True" which is not an option for me.  I need to validate the popup data in the codebehind before loading it into a collection and adding it to the grid.
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
 Select Case e.CommandName
    Case "Add"
  
        ' Add button pressed. Reset any rows in Edit mode
  
        Dim grid As RadGrid = CType(source, RadGrid)
  
        If (grid.EditItems.Count > 0) Then
  
            grid.MasterTableView.ClearEditItems()
  
        End If
  
  
  
        ' Manual "Add" Button pressed, put grid in Insert mode
  
        If e.CommandName = "Add" Then
  
            grid.MasterTableView.EditMode = GridEditMode.PopUp
  
            e.Item.OwnerTableView.IsItemInserted = True
  
            e.Item.OwnerTableView.Rebind()
  
        End If
  
      Case "PerformInsert"
             'here is where I cannot find the popup data.
  
  End Select

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 Mar 2012, 06:17 AM
Hi Steve,

Try the following code to access the data.

aspx:
<Columns>             
 <telerik:GridBoundColumn UniqueName="OrderId" DataField="OrderID"></telerik:GridBoundColumn>s
</Columns>

VB:
Protected Sub rRadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)
    Select Case e.CommandName
 
        Case "PerformInsert"
            Dim item As GridEditFormInsertItem = DirectCast(e.Item, GridEditFormInsertItem)
            Dim txt As TextBox = DirectCast(item("OrderId").Controls(0), TextBox)
            Exit Select
    End Select
End Sub

Regards,
-Shinu.


Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or