Hello,
I want to add a column that works like a GridEditCommandColumn but using a GridButtonColumn. This works but with one problem. The editor opens like in insert mode, but it should open below the current row where the user clicked the command.
Here is my approach:
In the GriItemCommand event handler, I check if my command was clicked and save the internal id (of the database record) of the row:
In the ItemDataBound event, I initialize the control which should be displayed (it gets the id of the row I saved to this.currentSelection.
In OnPreRender I call this code to display the editor:
While the editor is opened with the correct object, it is opened like insert mode (at top) and not below the clicked row. How can I tell the GridItem to open below the correct row?
Thanks!
Edit: I'm using GridEditFormType.Template as EditFormType
And I have already a GridEditCommandColumn in my grid and since you can only have one, I have to use a different apporach like above.
I want to add a column that works like a GridEditCommandColumn but using a GridButtonColumn. This works but with one problem. The editor opens like in insert mode, but it should open below the current row where the user clicked the command.
Here is my approach:
In the GriItemCommand event handler, I check if my command was clicked and save the internal id (of the database record) of the row:
private
void
GridItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName ==
"MyCommand"
)
{
this
.mycommand =
true
;
this
.currentSelection =
int
.Parse(((GridDataItem)(e.Item)).EditFormItem.ParentItem[Grid.IdColumnUniqueName].Text);
this
.parentItem = ((GridDataItem)(e.Item)).EditFormItem.ParentItem;
}
}
In the ItemDataBound event, I initialize the control which should be displayed (it gets the id of the row I saved to this.currentSelection.
In OnPreRender I call this code to display the editor:
Grid.MasterTableView.IsItemInserted =
true
;
Grid.Rebind();
While the editor is opened with the correct object, it is opened like insert mode (at top) and not below the clicked row. How can I tell the GridItem to open below the correct row?
Thanks!
Edit: I'm using GridEditFormType.Template as EditFormType
And I have already a GridEditCommandColumn in my grid and since you can only have one, I have to use a different apporach like above.