asp.net在gridview中用int值创建星星时遇到麻烦 [英] asp.net trouble creating stars out of an int value in gridview

查看:69
本文介绍了asp.net在gridview中用int值创建星星时遇到麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<b></b>Using visual studio 2010

I have a gridview - which has an int in column 4.  i have created a 5th column and I need to link to column 4 so that I get the value and then convert that to stars.  I have followed many links and tutorials to get the ajax rating control to work - to n avail so now I think it would be "easier" I am only a beginner so struggling at the best of times.  the code I have for the gridview is as follows:

GRIDVIEW CODE: usual gridview code plus:                      

            <asp:BoundField DataField="SalonName" HeaderText="SalonName"

                SortExpression="SalonName" />
            <asp:BoundField DataField="SalonLocation" HeaderText="SalonLocation"

                SortExpression="SalonLocation" />
            <asp:BoundField DataField="ReviewText" HeaderText="ReviewText"

                SortExpression="ReviewText" />
            <asp:BoundField DataField="Rating" HeaderText="Rating"

                SortExpression="Rating" />
</Columns>
 

I have no code running in vb relating to this panel.  basically the last column is Rating...it is an int so I want to make a sixth column that will show a number of stars (saved in images file) depending on the int in the fifth column.  any help is appreciated!
Thanks in Advance

推荐答案

您可能想看看如何在gridview中使用TemplateField。它允许您添加自己的标记。请查看此链接,了解如何在gridview中使用模板字段 http://msdn.microsoft.com/en-us /library/bb288032.aspx [ ^ ]



您必须专门创建一个能够保持评级控制的itemtemplate。



希望有所帮助..

Pawan
You might wanna look at how to use the TemplateField in gridview. It allows you to add your own markup. Check this link out on how to use templatefields in gridview http://msdn.microsoft.com/en-us/library/bb288032.aspx[^]

You will have to specifically create a itemtemplate that will hold the rating control.

Hope that helps..
Pawan


这篇关于asp.net在gridview中用int值创建星星时遇到麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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