Formatting values from a recordset?

Zick

New Member
When displaying a value in a datalist, one uses the following syntax...<BR><BR><form><BR><ItemTemplate><BR><%# DataBinder.Eval(Container.DataItem, "theFieldName")%><BR></ItemTemplate><BR></form><BR><BR>now is there any way to assign the value above to a variable so I can do some text formatting on it, i.e<BR><BR><form><BR><ItemTemplate><BR>myVar = DataBinder.Eval(Container.DataItem, "theFieldName")<BR></ItemTemplate><BR></form><BR><BR>this doesn't work in ASP.NET but I need to get this value into a variable so I can format it with functions such as Replace() etc.<BR><BR>Thanks<BR>Greg<BR><BR><BR>Try this something like that<BR><BR><form> <BR><ItemTemplate> <BR> <%# FmtText(DataBinder.Eval(Container.DataItem, "theFieldName")) %> <BR></ItemTemplate> <BR></form<BR><BR>Function FmtText(fvTEXT)<BR> Dim fvFTEXT as string<BR> fvFTEXT = Replace(fvTEXT,"$","")<BR> return fvFTEXT<BR>End Function<BR><BR>or<BR><BR><form> <BR><ItemTemplate> <BR> <%# DataBinder.Eval(Container.DataItem, "theFieldName"),"{0:dd MMM yyyy}") %> <BR></ItemTemplate> <BR></form<BR><BR>refer Page 289 of Wrox Professional ASP.NETHey, thanks very much.<BR><BR>Worked excatly as I had hoped.<BR><BR>That # thingy cofused me but now all I have to do is write functions to put text out as I want...<BR><BR>Thanks<BR>Greg<BR>
 
Back
Top