当其他 updatepanel 刷新 updatepanel 时,通过触发器刷新 updatepanel,因为第一个必须具有 UpdateMode=Conditional

发布于 2024-09-07 09:05:09 字数 363 浏览 1 评论 0原文

我在 ASP.NET 页面中有一些更新面板。我希望 updatepanel 2 在 updatepanel 1 刷新时刷新,但 UpdatePanel 2 的 UpdateMode 属性设置为 Conditional 且 ChildrenAsTrigger=False,因为它内部有另一个 updatePanel,我需要控制它的刷新方式。我试图触发另一个更新面板,但这似乎不起作用,也许我错过了一些东西

有没有办法做到这一点?

如果您无法找到有效的示例,请想象产品类别列表和产品列表,当所选类别更改(更新面板内的链接按钮)刷新位于另一个更新面板内的产品列表时,产品列表会发生变化,例如当您按价格订购时(订单为在其他更新面板内)并且我不希望刷新类别列表。

提前致谢。

I have some updatepanels in asp.net page. I want updatepanel 2 get refreshed when updatepanel 1 does, but UpdatePanel 2 has his UpdateMode attributed set to Conditional and ChildrenAsTrigger=False, because it has another updatePanels inside and i need to control the way it is refreshed. I was trying to make a trigger for the other updatepanel but this seems not work, maybe i am missing something

Is there a way to make this happen?

If you can't figure a valid example, imagine product category list and product list, when selected category change (linkbutton inside updatepanel) product list is refreshed which is inside another updatepanel, product list change for example when you order by price (order is inside other updatepanel) and i don't want category list gets refreshed.

thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

缱倦旧时光 2024-09-14 09:05:09

您可以调用 updatePanelProdList.Update( ) 在页面的代码隐藏文件中。在您的场景中调用此方法的位置是类别更改 LinkBut​​ton 的事件处理程序。

You can call updatePanelProdList.Update() inside the code-behind file of your page. The place to call this method in your scenario would be the event handler for the category change LinkButton.

一场春暖 2024-09-14 09:05:09

谢谢你,这就是我正在寻找的!我的页面上有 2 个“更新面板”,一个保留我的表单,另一个保留 FlexiGrid(非 .net 版本,纯 jQuery)。

我从网格中执行手动 AsyncPostBack 以进入编辑或删除模式。

function doPostBackAsync(eventName, eventArgs) {
    var prm = Sys.WebForms.PageRequestManager.getInstance();

    if (!Array.contains(prm._asyncPostBackControlIDs, eventName)) {
        prm._asyncPostBackControlIDs.push(eventName);
    }

    if (!Array.contains(prm._asyncPostBackControlClientIDs, eventName)) {
        prm._asyncPostBackControlClientIDs.push(eventName);
    }
    __doPostBack(eventName, eventArgs);
}

<a title="Edit" href="javascript:doPostBackAsync('Edit','2');">Edit</a>

然后我像

string EventName = Request.Form["__EVENTTARGET"].ToString();
int EventValue = Request.Form["__EVENTARGUMENT"].ToString();

在确定 EventName 和 EventValue 调用下面的方法之后

protected void Edit(int id)
{
    //load the form here
    UpdatePanel1.Update(); //do the trick right, without this line unable to show form fields and other stuff with newly loaded data
}

一样处理它。

(对不起我的英语)

Thank you, that's what i am looking for! I have 2 "Update Panel" on my page, one keeping my form and other one keeping flexiGrid (non .net version,pure jQuery).

I do manual AsyncPostBack from my grid to get in edit or delete mode.

function doPostBackAsync(eventName, eventArgs) {
    var prm = Sys.WebForms.PageRequestManager.getInstance();

    if (!Array.contains(prm._asyncPostBackControlIDs, eventName)) {
        prm._asyncPostBackControlIDs.push(eventName);
    }

    if (!Array.contains(prm._asyncPostBackControlClientIDs, eventName)) {
        prm._asyncPostBackControlClientIDs.push(eventName);
    }
    __doPostBack(eventName, eventArgs);
}

<a title="Edit" href="javascript:doPostBackAsync('Edit','2');">Edit</a>

and then i handle it like

string EventName = Request.Form["__EVENTTARGET"].ToString();
int EventValue = Request.Form["__EVENTARGUMENT"].ToString();

after determinate EventName and EventValue calling the method below

protected void Edit(int id)
{
    //load the form here
    UpdatePanel1.Update(); //do the trick right, without this line unable to show form fields and other stuff with newly loaded data
}

regards.

(sorry for my English)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文