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

[Solved] Custom command for control in edit template

2 Answers 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sabyasachi Dechaudhari
Top achievements
Rank 1
Sabyasachi Dechaudhari asked on 20 Jan 2010, 12:49 PM
I have a grid, with a edit item template.
It has a button, on click of which i want to populate a list box (while the user is in the edit mode of the row).
However, i cant get that control using the find control on that row.
When I change the command name to "Update", I can get the same in ((GridEditableItem)e.Item).FindControl("lbCatDesc"). The problem using the CommandName as "Update" is that it closes the edit view. However i want the user to be able to continue to edit

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Jan 2010, 01:46 PM
Hi Sabyasachi,

You can retain the editform from closing by setting e.Canceled=true; in the ItemCommand event.
      protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
      {
          if (e.CommandName == "Update")
          {
              e.Canceled = true;
          }
      }

A better suggestion is setting another CommandName other than "Update" so that the editform will not close on clicking the button.

-Shinu.
0
Sabyasachi Dechaudhari
Top achievements
Rank 1
answered on 20 Jan 2010, 01:53 PM
Thanks for your reply Shinu,

However, I cant get that control using the find control when i change the command name to any other custom name like "FillList".
Tags
Grid
Asked by
Sabyasachi Dechaudhari
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sabyasachi Dechaudhari
Top achievements
Rank 1
Share this question
or