本文介绍了显示标签的多个列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过列表框将多个值存储到数据库列。现在我的列值是这样的:21,34,12,

i有一个单独的表,这些值如21是食物,34是燃料,12是教育。

现在我想在一个转发器标签上显示这些所有值,分别用','像这样的食物,燃料,教育。

以前我只存储一个值,根据它,我正在取其相应的来自标签上其他表的值。我正在使用的代码是:

 选择 r。*,sc.subcategory_name 来自 tbl_adregister r  join  tbl_subcategory  as  sc  on  r.subcategory = sc.subcategory_id 



 <   asp:标签    ID   =  lbl_subcategory    runat   =  server   文本  ='  <% #Eval(  subcategory_name)%>' >   <   / asp:Label  >  



子类别列值:21

结果:食物



现在我想要这样展示......

子类别列值:21,34,12,

结果:食物,燃料,教育

解决方案

i am storing multiple values through a listbox to database column. Now in my column values are like this : 21,34,12,
i have a seperate table for these values like 21 is food, 34 is fuel, 12 is education.
now i want to show these all values on one repeater label seperated by ',' like this food,fuel,education.
Previously i am storing only one value and according to it i am fetching its corresponding value from other table on a label. Code i am using is:

select r.*, sc.subcategory_name from tbl_adregister r join tbl_subcategory as sc on r.subcategory=sc.subcategory_id


<asp:Label ID="lbl_subcategory" runat="server" Text='<%#Eval("subcategory_name")%>'></asp:Label>


subcategory column value: 21
Result: Food

Now i want to show like this...
subcategory column value: 21,34,12,
Result: Food,Fuel,Education

解决方案


这篇关于显示标签的多个列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 23:39