用户控件中的链接按钮不会触发更新面板中的单击事件 [英] Link button in user control does not fires click event inside update panel
问题描述
这是我的问题。
我有一个母版页。
我有更新我的母版页面中的面板。
我有一个default.aspx页面,这是我母版页的内容页面。
在我的母版页面中,我有一个链接按钮,一旦你点击它就会创建一个用户控件并将其添加到我的内容页面。
protected void lnk_home_Click( object sender,EventArgs e)
{
面板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);
}
在我的用户控制中我有一个链接按钮
< br $> b $ b
< asp:LinkButton ID =Link_returnrunat =serverCssClass =menu-item
CausesValidation =Falseonclick =Link_return_Click>返回
这是我的链接按钮的服务器端代码
受保护 void Link_return_Click( object sender,EventArgs e)
{
Panel pnl_view = this .Parent.FindControl(< span class =code-string> pnl_view) as Panel;
home home_view = LoadControl( home.ascx) as home;
pnl_view.Controls.Add(home_view);
}
当我点击用户控制中的链接按钮时,点击事件不会根本没有,我的控件都没有触发任何事件。
请帮帮我:(
< blockquote>在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"); });
这篇关于用户控件中的链接按钮不会触发更新面板中的单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!