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

Item Command Template

3 Answers 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John Giblin
Top achievements
Rank 1
John Giblin asked on 11 Jan 2013, 08:17 PM
I have an Edit Command Template which is a ascx file.

The problem that I am having is setting up the control.  Usually I use the !Page.IsPostBack to know when I set my form values.

But since I have a RadGrid with in a RadTree, when I fire the Edit command, it is true.  How can I tell when the edit command was clicked/executed?

Thanks
John

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Jan 2013, 06:35 AM
Hi,

You can check for the CommandName in ItemCommand event as shown below.
C#:
void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
   {
       if (e.CommandName == RadGrid.EditCommandName)
       {
       }
   }

Thanks,
Shinu
0
John Giblin
Top achievements
Rank 1
answered on 14 Jan 2013, 02:03 PM


That part is fine.  In fact I have

void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
   {
       if (e.CommandName == RadGrid.EditCommandName)
       {
                     otv.EditFormSettings.UserControlName = "UserControls/frmxxx.ascx";
       }
   }

the problem is knowing when that button is clicked to launch the usercontrol.  I usually look for !isPostback to know if I need to populate controls and set default values.  But that is true
0
Shinu
Top achievements
Rank 2
answered on 15 Jan 2013, 12:54 PM
Hi,

I am not sure about your requirement. I guess you are unable to show a WebUserControl as edit form. Please check the following code snippet.

C#:
protected void Page_Load(object sender, EventArgs e)
{
       RadGrid1.MasterTableView.EditFormSettings.EditFormType = GridEditFormType.WebUserControl;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.EditCommandName)
    {   
        e.Item.OwnerTableView.EditFormSettings.UserControlName = "WebUserControl1.ascx";
    }
}

Please elaborate your scenario if this doesn't help.

Thanks,
Shinu.
Tags
Grid
Asked by
John Giblin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
John Giblin
Top achievements
Rank 1
Share this question
or