手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >asp.net 保存、修改没有 runat=server控件的控件值的一个解决方案
asp.net 保存、修改没有 runat=server控件的控件值的一个解决方案
摘要:js:复制代码代码如下:functionSave()//保存不是服务端控件的值{var1=document.getElementById('...

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" maxlength="10"/>

<input type="text" id="2Box" 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];

【asp.net 保存、修改没有 runat=server控件的控件值的一个解决方案】相关文章:

ASP.Net中防止刷新自动触发事件的解决方案

asp.net注册Javascript的方法

asp.net“服务器应用程序不可用” 解决方法

ASP.NET从客户端中检测到有潜在危险的request.form值的3种解决方法

asp.net实现文件无刷新上传方法汇总

asp.net 设置GridView的选中行

asp.net动态加载自定义控件的方法

js获取.aspx页面里面的服务器控件和.ascx中的服务器控件值

asp.net 上传大文件解决方案

asp.net下Request.QueryString取不到值的解决方法

精品推荐
分类导航