如何保持类的部分回发一个ASP文本框 [英] How to keep the class of a ASP textbox on partial postback

查看:107
本文介绍了如何保持类的部分回发一个ASP文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望JQuery的脚本将确保在任何文本框是不是只读将应用更新的类,但就是没有发生,也是警报更是连显示。我想这是因为文本框是一个UpdatePanel内?

I was hoping the JQuery script will ensure any textbox which isn't readonly will apply update to the class but that is not happening and also the alert isn't even being displayed. I am thinking it is because the textboxes are inside an updatepanel?

我怎样才能保持文本框的状态,所以如果它在 colorRed 类,它与部分回发后仍然存在。

How can I keep the state of the textbox so if it had the colorRed class, it remains with that after a partial postback.

推荐答案

您可以更改服务器,而不是使用JS CssClass属性;
您还可以更改观看父元素,改变类的每个文本框的逻辑..用的只读的属性根据,例如。
的$(document)。在(变,#upPerson功能(){
    $(输入[只读=真])removeClass移除(colorBlue)addClass(colorRed)。;
});

我没有测试任何东西,但是这是逻辑。

You can change the CssClass in the server instead of using JS; You can also change the logic to watch the parent element and change the class of each textbox.. according with the ReadOnly attribute, for example. $(document).on("change", "#upPerson", function(){ $("input[readonly=true]").removeClass("colorBlue").addClass("colorRed"); }); I did not test anything, but that's the logic.

这篇关于如何保持类的部分回发一个ASP文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆