How to re-assign a value in a datalist.

C

craigkenisston

Hi,

In a datalist I'm displaying data comming from a SQL Server stored
procedure that contains null values in numeric values. Since the stored
is already used in other applications I can't change it.

So, I need to catch this nulls and convert them to zeroes so, they
display in the TD on the table I have in the datalist.

I have this method :

private void Repeater1_ItemDataBound(object sender,
System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
double d01;
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
if (DataBinder.Eval(e.Item.DataItem, "mypossiblenullfield") == null)
{
// what do I do here ?
}
};
}

It seems this code is being hitted, but I don't know how to change or
how to access the value of the DataItem.

Thanks in advance,
 
J

Jc Morin

Hi,

Maybe you can iterated over your results before datasource/databind and
replace null value with 0 or any changed needed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top