Using RadToolBar, RadListView ItemCommand

8 posts, 0 answers
  1. Caglar Duman
    Caglar Duman avatar
    10 posts
    Member since:
    Jun 2010

    Posted 18 Jul 2010 Link to this post

    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
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 22 Jul 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Caglar Duman
    Caglar Duman avatar
    10 posts
    Member since:
    Jun 2010

    Posted 23 Jul 2010 Link to this post


    Hello Yana,

    My question is that Listview's ItemCommand handler doesn't catch RadToolBarButton Clicks? Why?
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 28 Jul 2010 Link to this post

    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
  6. Caglar Duman
    Caglar Duman avatar
    10 posts
    Member since:
    Jun 2010

    Posted 29 Jul 2010 Link to this post


    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
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 02 Aug 2010 Link to this post

    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
  8. L. M. Pathan
    L. M. Pathan avatar
    20 posts
    Member since:
    Dec 2009

    Posted 26 Nov 2011 Link to this post

    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.
  9. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Nov 2011 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017