如何在ASP.NET中将浮点转换为整数?

如何在ASP.NET中将浮点转换为整数?,asp.net,vb.net,Asp.net,Vb.net,我试图在asp.net(使用vb.net)中为我的图像指定一个特定的宽度。 所以我使用了下一个代码: <asp:Image ID="PercentageImage" runat="server" Height="7px" Width='<%# Eval("votsGraph") %>' ImageUrl="~/images/bar.JPG" /> 那我该怎么投这个? (votsGraph的类型是float。)使用CInt(

我试图在asp.net(使用vb.net)中为我的图像指定一个特定的宽度。 所以我使用了下一个代码:

<asp:Image ID="PercentageImage" runat="server" Height="7px"
           Width='<%# Eval("votsGraph") %>'
           ImageUrl="~/images/bar.JPG" />

那我该怎么投这个? (votsGraph的类型是float。)

使用
CInt()


请注意,这个问题实际上只是关于VB.NET的,而不是关于ASP.NET的。@pst在我的回答中,我还必须更正一些ASP.NET标记以获得OP的要求。@Curt Yes,这就是为什么它被投票并被接受;-)试图向op展示[modern]ASP.NET只是底层语言/运行时之上的一层。
<asp:Image ID="PercentageImage" runat="server" Height="7px" Width='<%# string.format("{0}px", cint(Eval("votsGraph"))) %>' ImageUrl="~/images/bar.JPG" />
Width='<%# string.format("{0}px", cint(Eval("votsGraph"))) %>'