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

OnButton Click event in UserControl(.ascx) Page

2 Answers 330 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
baqi
Top achievements
Rank 1
baqi asked on 18 Aug 2008, 11:47 PM
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 Answers, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 19 Aug 2008, 04:10 PM
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.
0
Kasper Bergmann
Top achievements
Rank 1
answered on 06 Sep 2008, 09:21 PM
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
Tags
ToolBar
Asked by
baqi
Top achievements
Rank 1
Answers by
Helen
Telerik team
Kasper Bergmann
Top achievements
Rank 1
Share this question
or