Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ToolBar > Using RadToolBar, RadListView ItemCommand

Not answered Using RadToolBar, RadListView ItemCommand

Feed from this thread
  • Caglar Duman avatar

    Posted on Jul 18, 2010 (permalink)

    Hi,

    I've a RadToolBar in RadListView's itemTemplate.
    My problem is that; When I give CommandName to RadToolBarButtons. listview's ItemCommand function doesn't catch it.

    protected void lv_ItemCommand(object source, RadListViewCommandEventArgs e)
    {
    ...
    }

    ..
    <
    telerik:RadToolBar ID="tb" runat="server">
    <Items>
    <telerik:RadToolBarButton runat="server"  text="test" CommandName="Edit"></telerik:RadToolBarButton>
    </Items>
    </telerik:RadToolBar>
    ..


    only if I give a buttonClick command to RadToolBar, tb_ButtonClick function can do it..
    <telerik:RadToolBar ID="tb" runat="server" OnButtonClick="tb_ButtonClick">
    <Items>
    <telerik:RadToolBarButton runat="server"  text="test" CommandName="Edit"></telerik:RadToolBarButton>
    </Items>
    </telerik:RadToolBar>


    My Question is that; Is there any way to catch ListView_ItemCommand function by not using RadToolBar ButtonClick ?


    Thanks
    Sincerely,
    Caglar DUMAN

    Reply

  • Yana Yana admin's avatar

    Posted on Jul 22, 2010 (permalink)

    Hello Caglar,

    I'm not sure I understand the this requirement. Could you please explain in more details and send us more sample code? Thanks in advance

    Best wishes,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Caglar Duman avatar

    Posted on Jul 23, 2010 (permalink)


    Hello Yana,

    My question is that Listview's ItemCommand handler doesn't catch RadToolBarButton Clicks? Why?

    Reply

  • Yana Yana admin's avatar

    Posted on Jul 28, 2010 (permalink)

    Hi Caglar,

    You should set AutoPostBack property of the toolbar to true and ItemCommand event will be fired as expected:

    <telerik:RadToolBar ID="RadToolBar1"  runat="server" AutoPostBack="true">

    All the best,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Caglar Duman avatar

    Posted on Jul 29, 2010 (permalink)


    Thank you Yana it has worked :)

    By the way, 
    Can I fire InitInsert command of itemCommand event from outside the listview ?

    this code doesn't fire initinsert command:

    <telerik:RadListView>
    ...
    ...
    </telerik:RadListView>          
      
    <telerik:RadToolBar ID="tbInitInsert" runat="server" AutoPostBack="true">
      <Items>
       <telerik:RadToolBarButton Text="Insert" CommandName="InitInsert">
       </telerik:RadToolBarButton>
      </Items>
    </telerik:RadToolBar>

    Thank you

    Sincerely,
    Çağlar DUMAN

    Reply

  • Yana Yana admin's avatar

    Posted on Aug 2, 2010 (permalink)

    Hello Caglar,

    I'm afraid that this cannot be done outside the listview.

    Best regards,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • L. M. Pathan avatar

    Posted on Nov 26, 2011 (permalink)

    Telerik Team,

    I am using RadToolBar for Command Item inside a RadGrid but RadToolBarButton doesn't fire InitInsert Command.

    <CommandItemTemplate>
                <telerik:RadToolBar OnClientButtonClicked="onRadToolBarButtonClicked" Skin="Vista"
                    ID="RadToolBar1" runat="server" AutoPostBack="true">
                    <Items>
                        <telerik:RadToolBarButton Text="Add new student" ID="btnInitInsert" runat="server"
                            CommandName="InitInsert" ImageUrl="~/images/telerik/AddRecord.gif" ImagePosition="Left">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton Text="Delete student" ID="btnDelete" runat="server" CommandName="Delete"
                            ImageUrl="~/images/telerik/Delete.gif" ImagePosition="Left">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton Text="Toggle filtering" ID="ToggleFiltering" runat="server"
                            CommandName="ToggleFilterBar" ImageUrl="~/images/telerik/search.png" ImagePosition="Left">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton Text="Refresh" ID="btnRefresh" runat="server" CommandName="RebindGrid"
                            ImageUrl="~/images/telerik/Refresh.gif" ImagePosition="Left" CausesValidation="false">
                        </telerik:RadToolBarButton>
                    </Items>
                </telerik:RadToolBar>
            </CommandItemTemplate>

    How do I manage this? Please advise. Thank you for your help.

    Regards

    Pathan L.

    Reply

  • Posted on Nov 28, 2011 (permalink)

    Hello Pathan,

    I have tried the same in the version 2011.2.712.35 which worked as expected. Make sure that the CommandName is fired in ItemCommand event.
    C#:
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
      if (e.CommandName == "InitInsert")
       {//your code
       }
    }

    -Shinu.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ToolBar > Using RadToolBar, RadListView ItemCommand
Related resources for "Using RadToolBar, RadListView ItemCommand"

[   ASP.NET ToolBar Features  |  Documentation  |  Demos  |  Telerik TV   |   Self-Paced Trainer   |  Step-by-step Tutorial  ]