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

Edit mode after click event or grid is updated with new data

3 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
aj
Top achievements
Rank 1
aj asked on 26 Oct 2011, 02:34 PM
Hello everyone, I really need help. I'm trying to fire up the edit mode after an item is added after a click event.
Is there a way to do this ?

I've been searching and all I see is to default the edit mode on initial load.
Please help

Thanks

3 Answers, 1 is accepted

Sort by
0
aj
Top achievements
Rank 1
answered on 26 Oct 2011, 08:24 PM
Help ?
0
Princy
Top achievements
Rank 2
answered on 27 Oct 2011, 07:16 AM
Hello aj,

I am not sure about your requirement. I suppose you want to fire up edit mode on InsertCommand or on RowClick. So you can try the following code snippet.

i)On InsertCommand.

C#:
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
{
   foreach (GridItem item in RadGrid1.MasterTableView.Items)
 {
     if (item is GridEditableItem)
   {
       GridEditableItem itm = item as GridEditableItem;
        itm.Edit = true;
   }
 }
}

ii) On RowClick:

C#:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
 if (e.CommandName == "RowClick")
 {
   e.Item.Edit = true;
   RadGrid1.Rebind();
 }
}

Thanks,
Princy.
0
aj
Top achievements
Rank 1
answered on 04 Nov 2011, 08:37 PM

It worked by subscribing on the  pre-render

 

 

Private Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender

 

 

If _autoedit Then

 

 

 

 

 

_autoedit =

False

 

 

 

 

 

 

For Each Item As Telerik.Web.UI.GridItem In RadGrid1.MasterTableView.Items

 

 

If TypeOf Item Is GridEditableItem Then

 

 

 

 

 

 

If Item.Cells(2).Text = _OrdersAnd Loc2.SelectedValue.ToString = Item.Cells(8).Text Then

 

 

 

 

 

 

Dim EditableItem As GridEditableItem = DirectCast(Item, GridDataItem)

 

EditableItem.Edit =

True

 

 

 

 

 

RadGrid1.DataBind()

_orders=

""

 

 

 

 

 

 

Exit Sub

 

 

 

 

 

 

End If

 

 

 

 

 

 

End If

 

 

 

 

 

 

Next Item

 

 

End If

 

 

 


Tags
Grid
Asked by
aj
Top achievements
Rank 1
Answers by
aj
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or