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

How to Access The CommandItem template In Itemcommand Event

2 Answers 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sairam
Top achievements
Rank 1
Sairam asked on 28 Sep 2013, 02:08 PM

Hello telerik team,

   1.I Have following situation ...In My rad grid ..I am put  <CommandItemTemplate> in that i have radtoolBar  ..here  i declare ...a Button when ever  user click on button. I want to  Display one  rad window ..it  consist two  radListBox  ..of rad Column List in One  radListBox  ..an other One is  empty ..Whenever user select click Some Button Exist Between both List Box ...I want to Save same as it user selection Based On That I want Bind  show the column selection based to  radGrid ..... How to achieve scenario ..it is Possible ..here I tried But unable to visible the  radwindow ...
  <telerik:RadGrid ID="RadGrid1" runat="server" OnItemCommand="RadGrid1_ItemCommand">
            <MasterTableView AutoGenerateColumns="false" CommandItemDisplay="Top">
                <CommandItemTemplate>
                    <telerik:RadToolBar ID="RadToolBar1" runat="server" OnClientButtonClicking="onToolBarClientButtonClicking"
                        AutoPostBack="true">
                        <Items>
                            <telerik:RadToolBarButton Text="Customized Column" CommandName="CustomizedCol">
                            </telerik:RadToolBarButton>
                        </Items>
                    </telerik:RadToolBar>
                </CommandItemTemplate>
 
<CommandItemTemplate>
<telerik:radWindow id="radWindow " runat="server" visible="false" >
<body>
</CommandItemTemplate>
 
   
                <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="true" />
                <Columns>
</radgrid>

protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
   {
 
       if (e.CommandName == "CustomizedCol")
       {
 
           GridCommandItem item = (GridCommandItem)e.Item;
           RadWindow RadWindow1 = (RadWindow)item.FindControl("RadWindow1");
           RadWindow1.Visible = true;
           
       }
   }

here I not able to view The radwindow ...all code sucessfuly excute ..with out any exception ...But i am not getting the radwindow How to achieve above secnario..

Based on user section I want  to ...only selected Column .....


Thanks
sairam



 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 30 Sep 2013, 04:59 AM
Hi Sairam,

Here is the code I tried to show the RadWindow on RadToolBarButton click.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" OnItemCommand="RadGrid1_ItemCommand">
    <MasterTableView AutoGenerateColumns="true" CommandItemDisplay="Top">
        <CommandItemTemplate>
            <telerik:RadToolBar ID="RadToolBar1" runat="server" AutoPostBack="true">
                <Items>
                    <telerik:RadToolBarButton Text="Customized Column" CommandName="CustomizedCol">
                    </telerik:RadToolBarButton>
                </Items>
            </telerik:RadToolBar>
            <telerik:RadWindow ID="RadWindow1" VisibleOnPageLoad="true" Title="Telerik" NavigateUrl="http://www.telerik.com"
                runat="server" Visible="false">
            </telerik:RadWindow>
        </CommandItemTemplate>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.CommandName == "CustomizedCol")
    {
        GridCommandItem item = (GridCommandItem)e.Item;
        RadWindow RadWindow1 = (RadWindow)item.FindControl("RadWindow1");
        RadWindow1.Visible = true;
    }
}

Please try the above code and let me know if there is any concern.

Thanks,
Princy


0
Sairam
Top achievements
Rank 1
answered on 30 Sep 2013, 06:21 AM
Thanks,It Working
sairam
Tags
General Discussions
Asked by
Sairam
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Sairam
Top achievements
Rank 1
Share this question
or