如何在隐藏字段中存储列表框值并将该隐藏字段值存储到gridview中 [英] how to store listbox value in hidden field and store that hidden field value into gridview

查看:71
本文介绍了如何在隐藏字段中存储列表框值并将该隐藏字段值存储到gridview中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Listbox1如下



名称

Ramesh

Suresh

Vignesh

Rajesh



i将上面的listbox1项目存储到Hiddenfield。



我怎样才能在asp.net中使用c#。



问候

Narasiman P.

Listbox1 as follows

Name
Ramesh
Suresh
Vignesh
Rajesh

i wan to store the above listbox1 items into Hiddenfield.

for that how can i do in asp.net using c#.

Regards
Narasiman P.

推荐答案

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://stackoverflow.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://stackoverflow.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.


这篇关于如何在隐藏字段中存储列表框值并将该隐藏字段值存储到gridview中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆