更新面板和 JQuery 表单外观和感觉插件内的控件问题!!!帮助

发布于 2024-09-15 08:33:19 字数 1604 浏览 4 评论 0原文

我在更新面板控件下更新表单元素外观时遇到问题。
我使用 统一 JQuery 插件 来塑造表单控件(例如 DropDown)。它在 ASP.net 表单中工作得很好,但当用户选择 dropDownList 项目时,我使用更新面板来生成 CheckboxList 项目。
下图显示了表单的外观和感觉:
alt text

但是当我从列表中选择一个类别来更新 UpdatePanel 模板并更新复选框时,统一样式将从位于内部的控件中删除更新面板:
alt text

我在表单上方调用统一函数:

            <script type="text/javascript">
                $(function() {
                    $("input, textarea, select, button").uniform();
                });
            </script>

并更新面板标记:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <p>
                انتخاب دسته:&nbsp;<myCtrl:CategoryDDL AutoPostback="True" EmptyItemText="همه‌ی دسته‌ها"
                    ID="CategoryDDL" OnSelectedIndexChanged="CategoryDDL_SelectedIndexChanged" runat="server"
                    SelectedCategoryId="0" />
            </p>
            <p>
                برند محصولات<br />
                <asp:CheckBoxList ID="CheckBoxListBrands" runat="server">
                </asp:CheckBoxList>
            </p>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="CategoryDDL" />
        </Triggers>
    </asp:UpdatePanel>



知道有人可以帮我纠正这个错误吗???有没有可能的方法来防止删除更新面板控件样式?

I have a problem with Updating Form Element Look and Feel under Update Panel Control.
I Used Uniform JQuery Plugin to shape form controls such as DropDown. it works very well in a ASP.net form but i used an update panel to generate CheckboxList Items when user selects a dropDownList Item.
The picture Below Shows form Look and Feel:
alt text

but when I Select a Category from list to update the UpdatePanel Template and updating CheckBoxes the uniform style removes from controls located inside update panel:
alt text

I call uniform function above the form:

            <script type="text/javascript">
                $(function() {
                    $("input, textarea, select, button").uniform();
                });
            </script>

and Update Panel Markup:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <p>
                انتخاب دسته: <myCtrl:CategoryDDL AutoPostback="True" EmptyItemText="همه‌ی دسته‌ها"
                    ID="CategoryDDL" OnSelectedIndexChanged="CategoryDDL_SelectedIndexChanged" runat="server"
                    SelectedCategoryId="0" />
            </p>
            <p>
                برند محصولات<br />
                <asp:CheckBoxList ID="CheckBoxListBrands" runat="server">
                </asp:CheckBoxList>
            </p>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="CategoryDDL" />
        </Triggers>
    </asp:UpdatePanel>

Know Can Anyone Help me to correct this bug??? is there any possible way to keeping update panel control style from removing?

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

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

发布评论

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

评论(2

明月松间行 2024-09-22 08:33:20

您无法阻止它删除样式(元素被完全替换),但您可以通过在代码中运行一次来​​重新应用它:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function() {
  $("#updatePanelDiv :input").uniform();
});

它的作用是附加一个事件处理程序,以便在 endRequest 事件 UpdatePanel 触发(每次它会带着新的内容/元素回来)。

如评论中所述,将 UpdatePanel 包装在包装器中将限制插件此区域。

You can't keep it from removing the styles (the elements are replaced completely), but you can re-apply it by running this once in your code:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function() {
  $("#updatePanelDiv :input").uniform();
});

What this does is attach an event handler to run the plugin again when the endRequest event of the UpdatePanel fires (each time it comes back with new content/elements).

As noted in comments, wrapping the UpdatePanel in a wrapper will restrict the plugin to just this area.

﹎☆浅夏丿初晴 2024-09-22 08:33:20

更改此方法

$(function() {
$("input, textarea, select, button").uniform();
});

就是

function pageLoad(){
 $("input, textarea, select, button").uniform();
}

这样。

change this method

$(function() {
$("input, textarea, select, button").uniform();
});

with

function pageLoad(){
 $("input, textarea, select, button").uniform();
}

that is it..

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