且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用户控件中的链接按钮不会触发更新面板中的单击事件

更新时间:2023-12-06 11:45:04

在JQuery中尝试...在jQuery的文档就绪函数中编写以下代码。



 


#Link_return)。live( 点击,function(){
alert( Link_return按钮成功激活);
});


Here is my problem.

I have a master page.

I have an update panel in my master page.

I have a default.aspx page which is content page of my master page.

In my master page I have a link button, Once you click on that It creates a user control and adds it to my content page.

protected void lnk_home_Click(object sender, EventArgs e)
    {

    Panel pnl_view = ContentPlaceHolder1.FindControl("pnl_view") as Panel;
    home home_view = LoadControl("home.ascx") as home;
    pnl_view.Controls.Clear();
    pnl_view.Controls.Add(home_view);

    }



in my user control I have a link button



<asp:LinkButton ID="Link_return" runat="server" CssClass="menu-item"
CausesValidation="False" onclick="Link_return_Click">Return

This is server side code of my link button

protected void Link_return_Click(object sender, EventArgs e)
{
Panel pnl_view = this.Parent.FindControl("pnl_view") as Panel;
home home_view = LoadControl("home.ascx") as home;

pnl_view.Controls.Add(home_view);

}



When I click on the link button in user control click event does not fire at all, none of my controls fires any event at all.

Please help me :(

Try it in JQuery...Write the below code with in document ready function of jQuery.



("#Link_return").live("click", function () { alert("Link_return button fired successfully"); });