[英]How to get the div display property in c#.net before i changed div property in javascript
i Have one div in my default web page . 我在默认网页中有一个div。 The div style display none, that time in page load event i have to get the status none, but the div status changed in javascript function based on dropdown selection that i dosenot get the none status always show "" status, my code is
div样式显示无,在页面加载事件中的时间我必须得到状态none,但是在javascript函数中根据下拉选择更改了div状态,我得到了无状态总是显示“”状态,我的代码是
aspx page aspx页面
<div id="Div1" runat="server" clientidmode="Static" style="display: none;">
pageload event pageload事件
string Display1 = "";
Display1 = Div1.Style["display"]; (working fine)( get the display1 value=none)
when i button click show the div like that in c# code 当我按下按钮时,在c#代码中显示div
Div1.Style.Add("display", "");(now show the div it is correct)
Dropdown Changed fire javascript function code Dropdown更改了fire javascript功能代码
document.getElementById('Div1').style.display = 'none'; (after change dropdown Hide the div after pageload i got Display1 value="")
After changed javascript function i doenot get the none status in page load 更改javascript函数后,我在doenot中获取页面加载中的无状态
DIV is a HTMLGenericalControl in ASP.Net and any changes you make it in the client to its style or attributes, i dont think it will be posted back to server, instead you can track the changes on a Hidden control which has runat server attribute to true and capture the changes. DIV是ASP.Net中的HTMLGenericalControl以及你在客户端根据其样式或属性进行的任何更改,我认为它不会发布回服务器,而是可以跟踪具有runat服务器属性的Hidden控件的更改为true并捕获更改。
let me know if it helps 让我知道它是否有帮助
you can use like this it's below 你可以这样使用它在下面
<script type="text/javascript">
$(function () {
$("#lnkCompany").click(function () {
if ($("#dvClientReg").css('display') == 'block') {
$("#dvClientReg").css('display', 'none');
}
if ($("#dvCompanyReg").css('display') == 'none') {
$("#dvCompanyReg").css('display', 'block');
}
});
});
</script>
i think this will help you 我想这会对你有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.