English 中文(简体)
Jquery在App.net控制区停工,装满部分后
原标题:Jquery stops working in Asp.net control when loaded by a partial postback

in an ASP.net/C# application. I am using the an update panel and a Placeholder inside it to dynamically load controls

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click"/>
    </Triggers>
    <ContentTemplate>
        <asp:PlaceHolder ID="PlaceHolder1" runat="server">
        </asp:PlaceHolder>
    </ContentTemplate>
</asp:UpdatePanel>

当我点击CLinkButton1 I,在Pord装上用户控制:

protected void LinkButton1_Click(object sender, EventArgs e)
{
    PlaceHolder1.Controls.Clear();
    MyControl C;
    C = (MyControl1 )LoadControl("Controls/MyControl.ascx");
    PlaceHolder1.Controls.Add(C);
}

我所有的控制权都是正确的。

但问题是:

I have a control that uses Javascript and Jquery to create a drop down animation when I click on a div. This control works correctly when loaded on a page by a Normal PostBack But When I load it in the update panel using a partial post back, it loads but the javascript stops working (No more drop down animation and other stuff)

我如何在通过部分后退来装载控制时发挥作用?

最佳回答

I think your animation is being registered at a $(document).ready() event. Then it registers on the all divs, the specific animation. If you do a postback to your updatepanel, then the document ready event isn t fired, so the animation is registered. You should do it yourself again after a postback in an updatepanel.

问题回答

我认为,利用Jquery“Live”可能是你所期望的答案,这将监测OMM的变化。

1 P-4, 1 P-3, 1 P-2, 1 FS, 1 GS, 1 NS, 1 UNV

查阅关于进一步信息的分类文件。

我的猜测是,你对降水的估算是在dom的准备下进行的。 因此,你的随便页的载荷在下台所需的一切地方都形成了 an。

部分员额只撤回了装满负荷的那部分,因此没有确定估算值。 因为它不是最初准备就绪的Dom的一部分。

您将需要在部分员额返回后启动一些 j,以履行你可能不得不确定的同样职能。

Edit

• 如何控制 Java在经过更新后的部分退却后运行?

Should help you execute the javascript after the update panel has returned.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签