How to Access The CommandItem template In Itemcommand Event

3 posts, 0 answers
  1. Sairam
    Sairam avatar
    56 posts
    Member since:
    May 2013

    Posted 28 Sep 2013 Link to this post


    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Sep 2013 Link to this post

    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


  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sairam
    Sairam avatar
    56 posts
    Member since:
    May 2013

    Posted 30 Sep 2013 Link to this post

    Thanks,It Working
    sairam
Back to Top