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

Event not firing in User Control

2 Answers 354 Views
TileList
This is a migrated thread and some comments may be shown as answers.
Scott Manning
Top achievements
Rank 1
Scott Manning asked on 17 Jun 2013, 02:53 PM

I have a user control within a RadContentTemplateTile and within this user control there is a button that is not firing the handler within the code base of the user control.  The Page_Load function is getting called within the user control, but not the button1_click handler when I click on the button

Below is the HTML

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="HTML5_test2.Default" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="~/TestPage1.ascx" TagPrefix="uc1" TagName="TestPage1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        </telerik:RadAjaxManager>

        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <div>
            <telerik:RadTileList ID="RadTileList1" runat="server" AutoPostBack="true">
                <Groups>
                    <telerik:TileGroup>
                        <telerik:RadContentTemplateTile runat="server" ID="uc1" Name="firstContentTemplateTile" Shape="Wide">
                            <ContentTemplate>
                                <uc1:TestPage1 runat="server" ID="TestPage1" />
                            </ContentTemplate>
                        </telerik:RadContentTemplateTile>
                    </telerik:TileGroup>
                </Groups>
            </telerik:RadTileList>
        </div>
    </form>
</body>
</html>

This is the code for the user control

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HTML5_test2
{
    public partial class TestPage1 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = DateTime.Now.ToString();
        }
    }
}



2 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 18 Jun 2013, 11:34 AM
Hi Scott,

Thank you for your report. I am logging this issue for research here. I have also updated your Telerik points. Also, the AutoPostBack from the RadTileList should be disabled if you want to work with postback events from inside its tiles, otherwise the click will bubble to the tile and the tilelist itself will post the page.


Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
haguila
Top achievements
Rank 2
answered on 25 Jun 2013, 06:45 PM
Hi Scott;
I had the same problem here.
A "Tiled" RadButton does not fire the call to the Code Behind handler. But that this works fine at client side.

So, You can dirty-solve the problem mediatizing the event firing on client side:
By Example, in the ASPx, you can rename your Tiled button as "Bot2" and add OnClientClicked="llevaclick".  Then add an invisible button for the real click event handling, with the name use in the CodeBehind handling (Ex: "BotIngresar"). Finnaly add little script to port the onClicked event to the click event really handled on the code behind.
Example
A. The tiled Button: <telerik:RadButton ID="Bot2" runat="server" Text="In" Width="150px" OnClientClicked="llevaclick">
B. The Invisible Button:

<div style="padding: 10px; visibility: hidden; display: none;" >

<telerik:RadButton ID="BotIngresar" runat="server" Text="Ingresar" Width="150px">
</div>
C. The JS code: function llevaclick(sender, args) { 

var _objBtn;

 _objBtn = document.getElementById('BotIngresar');

 _objBtn.click();

}

D. The CodeBehind Function Header:

Protected Sub BotIngresar_Click(sender As Object, e As EventArgs) Handles BotIngresar.Click

 
Tags
TileList
Asked by
Scott Manning
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
haguila
Top achievements
Rank 2
Share this question
or