I am new to asp.net and ajax, so please excuse me if I don't express myself correctly
On my page I have a RadScheduler, and I use LinqDataSource to my database. In my database I have some columns which allow nulls.
I want to display these values in the AdvancedForm of my scheduler, and I have added them through the smart tag - ResourceTypes Collection Editor. The problem is that if some values are null I get an exception saying "Object reference not set to an instance of an object." It seems like it works fine for integer values, but not for string and boolean?
For the string columns I have modified the code in the DataClasses.designer.cs file, even though I don't like this solution...:
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Comment", DbType="VarChar(50)")]
public string Comment
{
get
{
if( string.IsNullOrEmpty(this._Comment ))
return string.Empty;
else
return this._Comment;
}
set
{
if ((this._Comment != value))
{
this.OnCommentChanging(value);
this.SendPropertyChanging();
this._Comment = value;
this.SendPropertyChanged("Comment");
this.OnCommentChanged();
}
}
}
For boolean values I could do something like this:
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Private", DbType="Bit")]
public System.Nullable<
bool
> Private
{
get
{
if (this._Private.HasValue)
return this._Private;
else
return false;
}
set
{
if ((this._Private != value))
{
this.OnPrivateChanging(value);
this.SendPropertyChanging();
this._Private = value;
this.SendPropertyChanged("Private");
this.OnPrivateChanged();
}
}
}
Could someone please tell me what I am missing here?
Regards, Jill-Connie Lorentsen