发布于 2016-06-18 12:05:42 | 132 次阅读 | 评论: 1 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

ASP.NET

ASP.NET 是.NET FrameWork的一部分,是一项微软公司的技术,是一种使嵌入网页中的脚本可由因特网服务器执行的服务器端脚本技术,它可以在通过HTTP请求文档时再在Web服务器上动态创建它们。 指 Active Server Pages(动态服务器页面) ,运行于 IIS(Internet Information Server 服务,是Windows开发的Web服务器)之中的程序 。


asp.net 保存、修改没有 runat=server控件的控件值的一个解决方案,需要的朋友可以参考下。

js:

 
function Save()//保存不是服务端控件的值 
{ 
var 1= document.getElementById('1Box').value; 
var 2 = document.getElementById('2Box').value; 
var TxtValue = 1 + "■" + 2; 
document.getElementById('3).value = TxtValue; 
return true; 
} 
window.onload=function show() 
{ 
var TxtValue = document.getElementById('3).value; 
if (TxtValue != "") { 
EachValue = new Array(); 
EachValue = TxtValue.split('■'); 
document.getElementById('1Box').value = EachValue[0]; 
document.getElementById('2Box').value = EachValue[1]; 
} 
return true; 
} 

html:
 
<input type="text" id="1Box" class="txt-underline" style="width: 60px;text-align:left " maxlength="10"/> 
<input type="text" id="2Box" class="txt-underline" style="width: 200px;text-align:left" maxlength="30"/> 
<input type="hidden" id="3" name="Values" runat="server" /> 

CS:
 
void LoadData()//页面加载 
{ 
btnSave.Attributes.Add("onclick", "javascript:Save();"); 
string[] strTxtValues = new string[2]; 
strTxtValues[0] = dr["1"].ToString(); 
strTxtValues[1]=dr["2"].ToString(); 
string strValues = strTxtValues[0]; 
for (int i = 1; i < strTxtValues.Length; i++) 
{ 
strValues += "■" + strTxtValues[i]; 
} 
this.3.Value = strValues; 
} 
private void SaveOrUpdate()//保存、修改 
{ 
string[] strTxtValues = this.3.Value.Split('■'); 
string 1= strTxtValues[0]; 
string 2= strTxtValues[1]; 



最新网友评论  共有(1)条评论 发布评论 返回顶部
lfivxa 发布于2016-07-21 16:43:20
1W个赞,感谢楼主!
支持(0)  反对(0)  回复

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务