PDA

View Full Version : calculating from datafield


urko
04-28-2009, 05:01 PM
Hi.

Not sure how to explain this.

I have created a datalist to show some data from the ms access db.

what i would like is that this certain data
<asp:Label ID="weightLabel" runat="server" Text='<%#("weight11")%>'/>
is multiply by lets say 10 and that would be the result shown on aspx. page.

is it possible that some1 shows me how to do it in code behind (C#)

i know how to do it in classic asp, but i dont know how to do it in .net.

thanks

SouthwaterDave
05-23-2009, 02:42 PM
Add this to your code behind:

protected string MultiplyBy10(int value)
{
return (value * 10).ToString();
}

and change your control like this:

<asp:Label ID="weightLabel" runat="server" Text='<%#MultiplyBy10(Eval("weight11"))%>'/>