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

[Solved] User Edit control form in radgrid

1 Answer 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tony Abou-Akl
Top achievements
Rank 1
Tony Abou-Akl asked on 20 Jul 2009, 07:31 PM
Is it possible to have 2 user Edit control form called from a rad grid

I have a grid control that will have "edit link" and "Abc Link" at the end
I also created 2 web user controls: Contor 1 for the edit link and the Control 2 for the ABC link.
Is there a way to call control one when click on Edit link and to open control 2 when clicking on ABC link

I know how to do it if i only have the Edit link but i need a way to be able o have multiple user control called from a radgrid

Thanks in Advance

Tony

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Jul 2009, 04:59 AM
Hello Tony,

You can use another buttoncolumn with its CommandName set to Edit and CommandArgument to say abc. Then you can set the UserControlName accordingly from the server side. Check out the code below:
aspx:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="Sqldatasource1" OnItemCommand="RadGrid1_ItemCommand"
      <MasterTableView DataSourceID="Sqldatasource1"
            <EditFormSettings EditFormType="WebUserControl" >         
            </EditFormSettings> 
            <Columns> 
                <telerik:GridEditCommandColumn> 
                </telerik:GridEditCommandColumn> 
                <telerik:GridButtonColumn Text="abc" CommandName="Edit" CommandArgument="abc"
                </telerik:GridButtonColumn> 

c#:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
       if (e.CommandName == "Edit"
        { 
            if (e.CommandArgument == "abc"
                e.Item.OwnerTableView.EditFormSettings.UserControlName = "abc.ascx"
 
            else 
                e.Item.OwnerTableView.EditFormSettings.UserControlName = "EditForm.ascx"
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Tony Abou-Akl
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or