问题描述
你好,
我需要在页面中显示围栏视图,页面之间包含逗号.
表中的数据示例..
emp id ......... emp语言
1 .................英语
2 .................俄语
1 ........西班牙语
1 ........ American
2 ........ Chinise
我需要显示网格视图,如:
emp id ........ emp语言
1 .......英语,西班牙语,美国
2 .................俄语,中文
请帮忙...
提前谢谢.
hello,
i need to show a gird view in a page having data with comma in between them.
example of data in the table..
emp id.........emp Language
1.................English
2.................Russian
1.................Spanish
1.................American
2.................Chinise
i need to show the grid view like:
emp id........emp language
1................English,Spanish,American
2.................Russian,Chinise
please help ...
thanx in advance.
推荐答案
SELECT empid ,REPLACE(RTRIM((SELECT empLanguage + ' ' FROM TableName WHERE ( empid = Results.empid ) FOR XML PATH (''))),' ',', ') AS NameValues
FROM TableName Results
GROUP BY empid
应用以下代码绑定复选框
Apply below code to bind checkbox
for(int i=0;i<lstCheckBox.Items.Count;i++)
{
for(int j=0;j<ds.Table[0].Rows.Count;j++)
{
if(lstCheckBox.Items[i].Value == ds.Table[0].Rows[j]["LanguageId"].ToString())
lstCheckBox.Items[i].Selected = true;
}
}
这篇关于gridview问题,所以请帮帮我!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!