帮助GridView中的drodownlist [英] help in drodownlist inside gridview

查看:94
本文介绍了帮助GridView中的drodownlist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

谁能帮我解决这个问题.

我在gridview中有两个dropdownlist,值是yes和no.数据库包含我必须提取并填充到gridview中的所有字段.对于下拉列表,数据库包含0和1.对于从数据库中获取的所有行,如果value为1且没有value为0,则必须使下拉列表为yes.有人能给我关于它的任何想法吗?

谢谢.

hello friends,

can anybody help me with this issue.

I have two dropdownlist inside gridview with value yes and no. database contains all the fields i have to fetch and fill it in gridview. for the dropdowns the database contains 0 and 1. I have to make the dropdowns yes if value is 1 and no value is 0 for all the rows fetched from the database. can anybody provide me any idea regarding it.

thanking you.

推荐答案

在这里,请参阅:
Here, refer: CodeProject Frequently Asked Questions Series 1: The ASP.NET GridView[^]




实现GridView_RowDataBound事件,然后检查dropdown的值.然后相应地更改项目.

另一种选择是在查询中使用用户CASE子句,并从数据库中获取要显示的确切数据.

如下修改queyr

Hi,

Implement GridView_RowDataBound event and into this check the value of dropdown. And after that change the item accordingly.

Other option is to user CASE clause in your query and get the exact data from database as you want to display.

Modify queyr as below

DropDownColumnName = CASE tablecoulmname
WHEN tablecoulmname = 1 THEN "Yes" 
WHEN tablecoulmname = 0 THEN "No"
ELSE defaultvalue as per your requirement



希望对您有帮助.



Hope this will help you.


这篇关于帮助GridView中的drodownlist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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