English 中文(简体)
在我的更新小组完成其人力部人员装满后,我如何从我的密码中执行 Java?
原标题:How can I execute JavaScript from my code-behind after my UpdatePanel has finished loading its DOM elements?

我有一个更新小组,其中有一个重复,在用户通过“模式”向它增加一个项目后,该小组再次生效。

当他们点击 but子,向重复者增加一新行时,照相看像:

protected void lbtnAddOption_Click(object sender, EventArgs e)
{               
    SelectedOption = new Option()
    {
        Account = txtAddOptionAccountNumber.Text,
        Margin = chkAddOptionMargin.Checked,
        Symbol = txtAddOptionSymbol.Text,
        Usymbol = txtAddOptionUsymbol.Text,
     };

     Presenter.OnAddOption(); // Insert the new item
     RefreshOptions(); // Pull down and re-bind all the items
     mpeAddOptionDialog.Hide(); // Hide the modal 

     // ... Make call to jQuery scrollTo() method here?

}

这一工程课以罚款,新行将迅速通过更新小组展示。

However, there are often hundreds of rows and where the new one is added is based on the current sorting column used.

因此,我想借此机会利用。 我知道,如果我向它提供我的溢出的集装箱干.和其中的一个元件的识别,它将顺利地向新增加的电网用户开动。

然而,有两个问题:

  1. I need to find the appropriate row so I can snag the ClientID for it.
  2. I need to execute the jQuery snippet from my code-behind that will cause my newly updated repeater to scroll to the right row.

我解决了第1号。 我有一个可靠的方法,将产生新增加的浏览量用户信息。

然而,问题2正被证明是trick。 我知道,我只可以打电话到<条码>Romanager.RegisterStartupgust(<>/code>) 构成我的密码背后,并将在我的网页上执行 Java本。

问题Im在于,似乎正在执行新更新的OMS分子在 Java前的一段文字(一米gues)。 因此,尽管我通过适当的支部,以掌握我所希望的内容,但我却发现这一点是错误的,因为它可能发现这一点。

此处使用上述方法末所用的一米线:

     string clientID = getClientIdOfNewRow();  
     ScriptManager.RegisterStartupScript(this, typeof(Page), "ScrollScript", String.Format("$("#optionContainer").scrollTo("{0}", 800);", clientID), true);

我需要做些什么,才能确保 Java的这条线被叫上,直到更新小组的网页真正准备好为止?

问题回答

如果你需要处理的是更新小组,那么,当小组装满后,你需要管理你的联合材料。 我用的是“要求”。 下面是比较复杂的。 它一劳永逸地运作,但安装了“快车”手,每次更新小组时都会启动。 在火灾的时候,它给你们带来了一切。

var prm = Sys.WebForms.PageRequestManager.getInstance();
jQuery(document).ready(function () {
    prm.add_endRequest(EndRequestHandler);
});

function EndRequestHandler(sender, args) {
  // do whatever you need to do with the stuff in the update panel.
}

显然,如果你想要的话,你就可以从表面上注入。





相关问题
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!

热门标签