asp.net 保存、修改沒有 runat=server控件的控件值的一個解決方案
更新時間:2011年10月21日 10:59:20 作者:
asp.net 保存、修改沒有 runat=server控件的控件值的一個解決方案,需要的朋友可以參考下。
js:
復(fù)制代碼 代碼如下:
function Save()//保存不是服務(wù)端控件的值
{
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:
復(fù)制代碼 代碼如下:
<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:
復(fù)制代碼 代碼如下:
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控件中彈出詳細(xì)信息窗口
- asp.net實(shí)現(xiàn)刪除DataGrid的記錄時彈出提示信息
- asp.net中GridView和DataGrid相同列合并實(shí)現(xiàn)代碼
- ASP.NET MVC中EasyUI的datagrid跨域調(diào)用實(shí)現(xiàn)代碼
- ASP.NET MVC使用EasyUI的datagrid多選提交保存教程
- asp.net DataGrid 中文字符排序的實(shí)現(xiàn)代碼
- asp.net DataGridView導(dǎo)出到Excel的三個方法[親測]
- 在asp.net中實(shí)現(xiàn)datagrid checkbox 全選的方法
- 決定何時使用 DataGrid、DataList 或 Repeater(ASP.NET 技術(shù)文章)
- asp.Net JS取母板頁控件值的簡單方法
- Asp.net清空控件值的方法(可自定義控件類型)
- ASP.NET中訪問DataGrid中所有控件值的方法
相關(guān)文章
asp.net Gridview數(shù)據(jù)列中實(shí)現(xiàn)鼠標(biāo)懸浮變色
Gridview一般朋友們都比較常用,因?yàn)樗梢苑奖憧旖莸膶?shí)現(xiàn)我們所需的很多功能,代碼也比較簡潔。平時的項(xiàng)目中這個控件我也比較常用,其中有個功能用到的頻率也比較多。所以記錄下備忘。2010-06-06asp.net結(jié)合Ajax驗(yàn)證用戶名是否存在的代碼
關(guān)于Ajax的操作簡單總結(jié),結(jié)合Ajax驗(yàn)證用戶名是否存在的代碼2010-06-06在Framework4.0中實(shí)現(xiàn)延遲加載的實(shí)現(xiàn)方法
延遲加載,亦稱延遲實(shí)例化,延遲初始化等,主要表達(dá)的思想是,把對象的創(chuàng)建將會延遲到使用時創(chuàng)建,而不是在對象實(shí)例化時創(chuàng)建對象,即用時才加載。2011-08-08asp.net mvc 從數(shù)據(jù)庫中讀取圖片的實(shí)現(xiàn)代碼
今天搞了一天的MVC,在顯示圖片的時候老是出現(xiàn)問題,從網(wǎng)上搜索了好久,才找到解決方法。2010-05-05為HttpClient添加默認(rèn)請求報頭的四種解決方案
這篇文章主要給大家介紹了關(guān)于為HttpClient添加默認(rèn)請求報頭的四種解決方案,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用HttpClient具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09HttpWebRequest和HttpWebResponse用法小結(jié)
在每個系統(tǒng)出寫入報告錯誤代碼(找個合理的理由,比如系統(tǒng)免費(fèi)升級) -> 自家服務(wù)器接收并處理錯誤報告 -> 反饋用戶(解決掉BUG就行,不要太聲揚(yáng))2011-09-09ASP.NET的事件模型(很適合學(xué)習(xí)的文章)
當(dāng)我們新建一個ASP.NET的應(yīng)用程序時,會默認(rèn)生成一個Default.aspx和Default.aspx.cs頁面2012-10-10