OnButton Click event in UserControl(.ascx) Page

3 posts, 0 answers
  1. baqi
    baqi avatar
    8 posts
    Member since:
    Oct 2007

    Posted 18 Aug 2008 Link to this post

    Hi

      I am using RadtoolBar in a user control(.ascx) page.Allthough i can see the button on the Page and access its javascript methods and properties , the server side click event is not firing.
    Below is my Code

    The user control code
    NotesControl.ascx

    <asp:Panel ID="Panel6" runat="server" Height="95%" Width="100%">

    <telerik:RadToolBar ID="RadSmallToolBar1" runat="server" Skin="Office2007" Width="650px" OnButtonClick="RadSmallToolBar1_Click" >

    <Items>

    <telerik:RadToolBarButton runat="server" PostBack="true" ImagePosition="Left" CausesValidation="false" DisabledImageUrl="~/Images/16x16/Save.gif" ImageUrl="~/Images/16x16/Save.gif" Value="Submit" Text="Save"></telerik:RadToolBarButton>

    </Items>

    </telerik:RadToolBar>

    </asp:Panel>

    Notecontrol.ascx.cs

    protected void RadSmallToolBar1_Click(object sender, Telerik.Web.UI.RadToolBarEventArgs e)

    {.....................

    }

    masterpage.aspx

    <radts:PageView ID="Page05" runat="server">

    <asp:Panel ID="Panel6" runat="server">

    <div style="background: url(../../Images/bg.jpg) no-repeat;">

    <div class="Header">

    Notes:

    </div>

    </div>

    <div style="padding-bottom: 0.25in">

    <rad:RadAjaxPanel ID="NotesAjaxPanel" runat="server" EnableAJAX="true">

    <asp:Panel ID="NotesLoadingPanel" runat="server" Width="100%">

    </asp:Panel>

    </rad:RadAjaxPanel>

    </div>

    </asp:Panel>


    masterpage.cs

    private void GetNotes()

    {

    Control notes = this.LoadControl("~/FormContainers/NotesControl.ascx");

    this.NotesLoadingPanel.Controls.Add(notes);

    }


    i tested with asp button and it is firing the clickevent but when i replace with toolbar the event is not firing.


    Thanks
    Baqi

  2. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 19 Aug 2008 Link to this post

    Hello,

    Could you try to attach to server-side ButtonClick event again. See the code below which works as expected at our side:

    //ascx:
    <asp:Panel ID="Panel6" runat="server" Height="95%" Width="100%">   
    <telerik:RadToolBar ID="RadSmallToolBar1" runat="server" Skin="Office2007" Width="650px" OnButtonClick="RadSmallToolBar1_Click">   
        <Items>   
        <telerik:RadToolBarButton runat="server" PostBack="true" ImagePosition="Left" CausesValidation="false" DisabledImageUrl="~/Images/16x16/Save.gif" ImageUrl="~/Images/16x16/Save.gif" Value="Submit" Text="Save">  
        </telerik:RadToolBarButton>   
        </Items>   
    </telerik:RadToolBar>   
    </asp:Panel>  

    //cs:
    protected void RadSmallToolBar1_Click(object sender, RadToolBarEventArgs e)  
        {  
            Response.Write("ButtonClickFired");  
          
        } 



    Greetings,
    Helen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kasper Bergmann
    Kasper Bergmann avatar
    14 posts
    Member since:
    Feb 2007

    Posted 06 Sep 2008 Link to this post

    Hi

    I had similar problem with RadToolBar in an ascx control - it was solved by using telerik:RadScriptManager instead of asp:ScriptManager in the master-page.

    Best regards,

    Kasper Bergmann
Back to Top