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

Use custom popup on Insert command

4 Answers 215 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 28 May 2013, 09:01 PM
What I would like to do is use a custom asp modal popup box on the perform insert command on a radgrid.  It works as I have it but the problem is that the grid also opens up to insert data as well, but only the data in my needdatasource statement.  Is there a way to block this from opening and only open my modal popup.

I know I could use a template commandline but am trying to use built in radgrid items as its less code and looks cleaner.

Protected Sub myRadGrid_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles myRadGrid.ItemCommand
       If (e.CommandName = RadGrid.InitInsertCommandName) Then
           pnlRegions_MPE.Show()
       End If
   End Sub

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 May 2013, 05:24 AM
Hi kevin,

Please try the following code in ItemDataBound event of the radgrid.

C#:
protected void RadGrid1_ItemDataBound1(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.OwnerTableView.IsItemInserted)
    {
        e.Item.OwnerTableView.IsItemInserted = false;
        pnlRegion_MPE.Show();
    }
}

There is another suggestion to this,please have a look at this documentation.

Thanks
Princy
0
Kevin
Top achievements
Rank 1
answered on 29 May 2013, 01:29 PM
HI,

Ok this portion worked but I do not know what else it will affect, only the worked.  If gave me an error under GridEditableItem. Said cannot be used as an expression.

e.Item.OwnerTableView.IsItemInserted = false

Protected Sub myRadGrid_ItemDataBound(sender As Object, e As GridItemEventArgs) Handles myRadGrid.ItemDataBound
       If (e.Item Is GridEditableItem And e.Item.OwnerTableView.IsItemInserted) Then
           e.Item.OwnerTableView.IsItemInserted = False
       End If
   End Sub

Doing this seems to work but do not know what else will affect

Protected Sub myRadGrid_ItemDataBound(sender As Object, e As GridItemEventArgs) Handles myRadGrid.ItemDataBound
          e.Item.OwnerTableView.IsItemInserted = False
  End Sub

this is my Item command satement

Protected Sub myRadGrid_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles myRadGrid.ItemCommand
      If (e.CommandName = RadGrid.InitInsertCommandName) Then
          e.Item.OwnerTableView.IsItemInserted = False
          pnlRegions_MPE.Show()
      End If
  End Sub





    

 

 

0
Accepted
Princy
Top achievements
Rank 2
answered on 30 May 2013, 06:51 AM
Hi Kevin,

Please try this code and check if its working.

VB:
Protected Sub RadGrid1_ItemDataBound1(sender As Object, e As GridItemEventArgs)
    If TypeOf e.Item Is GridEditableItem AndAlso e.Item.OwnerTableView.IsItemInserted Then
        e.Item.OwnerTableView.IsItemInserted = False
        pnlRegion_MPE.Show()
    End If
End Sub

Thanks,
Princy
0
Kevin
Top achievements
Rank 1
answered on 30 May 2013, 12:37 PM
Hi Princy,

Thanks for the help
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kevin
Top achievements
Rank 1
Share this question
or