如何在C#中获得动态填充下拉菜单的值 [英] How to get value of dynamically fill dropdown in C#

查看:154
本文介绍了如何在C#中获得动态填充下拉菜单的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友

我已经使用JQuery填充了dropdown(ddlVC),我想从后面的代码中获取ddlVC的选定值.

使用ddlVC.SelectedValue返回empty string

知道我将如何获得它吗?

在此先谢谢您

Hello friends

I have filled dropdown(ddlVC) using JQuery, I want to get the selected value of ddlVC from code behind.

Using ddlVC.SelectedValue returns empty string

Any idea how will i get it??

Thanks in advance

推荐答案

http://jsbin.com/oxoweh上可以找到代码示例. [^ ]


此给我所需的输出.

This gives me the required output.

Request.Form[ddlVC.UniqueID]


我认为您在page_load上绑定了DropDown,并且当您当时从中选择值时或当您的页面发回时,您的Dropdown列表变为空,因此显示为"'空字符串'
如果您遇到此问题,请检查您的DropDown属性"EnableViewState为True"

如果它为true,然后不能解决问题,则在整个页面和母版页中将其设置为"EnableViewState为True".

谢谢.
I think u have Bind DropDown at page_load and when u select value from it at that time or when your page post back at that time your Dropdown list become null so it shows ''empty string''
If u have this problem then check your DropDown Property ''EnableViewState as True''

If It is true and then not solved your problem then check in your whole page and master page where it was set as ''EnableViewState as True.

Thank You.


这篇关于如何在C#中获得动态填充下拉菜单的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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