In one of our pages we are using this bit of code to check if something is null and passing in a 0 instead. This works great for this page, but this was done by another person and thye are no longer here.. so i'd like to take that idea and create something similar but return a empty string or blank space, the reason is that i have a page where you make a selection from a gridview and onselect that rows data is passed into some textboxes.. well at the moment, if you select a row and one of the columns is blank, the textbox is being populated anyway with this so i would like to make sure that if there is nothing, that the textboxes are left blank.. since there is potential for having alot of textboxes, i would rather create a method that can do the checking instead of doing if condition for each parameter. does that make sense? If so any suggestions would be great. and thanks you
//CONVERTS NULL VALUES TO ZERO
protected string valid(OleDbDataReader myreader, int stval)
{
object val = myreader[stval];
if (val != DBNull.Value)
return val.ToString();
else
return Convert.ToString(0);
}
//END
View Complete Post