国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

asp.net 保存、修改沒有 runat=server控件的控件值的一個解決方案

2024-07-10 13:24:41
字體:
來源:轉載
供稿:網友

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" maxlength="10"/>
<input type="text" maxlength="30"/>
<input type="hidden" 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];

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 平南县| 巫山县| 策勒县| 昌吉市| 靖西县| 东阳市| 金川县| 满洲里市| 新郑市| 常宁市| 永川市| 萝北县| 夏河县| 疏附县| 广饶县| 海门市| 哈密市| 苗栗市| 大田县| 巴马| 大同市| 舞钢市| 秭归县| 楚雄市| 乌鲁木齐县| 湘潭市| 祁东县| 云霄县| 仙游县| 永康市| 津南区| 弥勒县| 中牟县| 扎囊县| 东源县| 西宁市| 榕江县| 丽江市| 惠来县| 乡城县| 恩施市|