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];

您可能感兴趣的文章:

  • asp.net DataGrid控件中弹出详细信息窗口
  • asp.net实现删除DataGrid的记录时弹出提示信息
  • asp.net中GridView和DataGrid相同列合并实现代码
  • ASP.NET MVC中EasyUI的datagrid跨域调用实现代码
  • ASP.NET MVC使用EasyUI的datagrid多选提交保存教程
  • asp.net DataGrid 中文字符排序的实现代码
  • asp.net DataGridView导出到Excel的三个方法[亲测]
  • 在asp.net中实现datagrid checkbox 全选的方法
  • 决定何时使用 DataGrid、DataList 或 Repeater(ASP.NET 技术文章)
  • asp.Net JS取母板页控件值的简单方法
  • Asp.net清空控件值的方法(可自定义控件类型)
  • ASP.NET中访问DataGrid中所有控件值的方法
声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。