且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在隐藏字段中存储列表框值并将该隐藏字段值存储到gridview中

更新时间:2023-02-11 21:05:48

HI Narasiman



你可以这样做

创建一个隐藏字段在aspx页面中

你可以在逗号分隔的字符串列表项 / code>到隐藏字段。



HI Narasiman

you can do like this
create a hidden field in the aspx page
and you can store the list items in comma separated string to the hidden field.

for (int i = 0; i < ListBox1.Items.Count; i++)
               {
                   hdnfld.Value += ListBox1.Items[i].Text + ",";
               }


参考: http://***.com/questions/3957153/sending-listbox-selected-values-as-hidden-field-using-jquery [ ^ ]



检查答案2.





http://forums .asp.net / t / 1639129.aspx?Simple + Store + selectedindex + + Listbox + in + HiddenField + and + then + Return + to + that + value + on + Postback + [ ^ ]



这可能会有所帮助。
Refer:http://***.com/questions/3957153/sending-listbox-selected-values-as-hidden-field-using-jquery[^]

Check Answer 2.

OR
http://forums.asp.net/t/1639129.aspx?Simple+Store+selectedindex+of+Listbox+in+HiddenField+and+then+Return+to+that+value+on+Postback+[^]

This may help otherwise ask here.