Dropdownlist中DataTextField和DataValueField的用法是什么? [英] What is the usage of DataTextField and DataValueField in Dropdownlist?

查看:350
本文介绍了Dropdownlist中DataTextField和DataValueField的用法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我对简单的事情有疑问,



到目前为止,我有在Dropdownlist中使用DataTextField和DataValueField而不知道用法,为什么我在从数据库绑定数据时使用它...



你知道我问的问题非常简单,但是我希望你能在以后的Dropdownlist中帮助我了解DataTextField和DataValueField的使用情况。





期待您的宝贵答案。 ......

Hi friends,

I have doubt about simple thing,

so far ,i have used DataTextField and DataValueField in Dropdownlist without knowing of tat usage, why i using this while binding data from database...

ya i know am asking very simple question, but i hope you will help me for knowing this usage of DataTextField and DataValueField in Dropdownlist hereafter.


am looking forward for your valuable answer.......

推荐答案

Asp.net下拉列表DataValuefield和datatextfields [ ^ ]



data-text-field-and-data-value-field-pr.aspx [ ^ ]


DataTextField是用户可以看到的。

DataValueField可用于识别从DropDownList中选择哪一个。



例如,您的数据库中有人。在这种情况下,DataValueField可以是人的ID,DataTextField可以是DropDownList中人员的名字。



检查以下内容:

DataValueField [ ^ ]

DataTextField [< a href =http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.datatextfield.aspxtarget =_ blanktitle =New Window> ^ ]
DataTextField is what the user can see.
DataValueField is what you can use for identify which one is selected from DropDownList.

For example you have people in your database. In this case the DataValueField can be the ID of the person and the DataTextField can be the name of the person in your DropDownList.

Check the follows:
DataValueField[^]
DataTextField[^]


您好


您可以找到与Dropdownlist相关的所有属性的用法。



http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist.aspx [ ^ ]


这篇关于Dropdownlist中DataTextField和DataValueField的用法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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