62,075
社区成员
发帖
与我相关
我的任务
分享
SaveValue();
function SaveValue()
{
var str = "";
for(var i=0;i<Form1.DropDownList1.options.length;i++)
{
var o = Form1.DropDownList1.options[i];
str += o.innerText +","+o.value+"|";
}
Form1.Hidden1.value =str;
}
if(this.IsPostBack)
{
string sValue = this.Hidden1.Value.Trim();
string[] ary = sValue.Split('|');
this.DropDownList1.Items.Clear();
for(int i=0;i<ary.Length;i++)
{
if(ary[i].Split(',').Length!=2)
continue;
this.DropDownList1.Items.Add(new ListItem(ary[i].Split(',')[0],ary[i].Split(',')[1]));
}