G
Guest
Hello,
in my aspx page I have the followong code:
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
....
<%# Server.HtmlDecode((string)DataBinder.Eval(Container.DataItem,"tekst")) %>
....
</ItemTemplate>
</asp:Repeater>
Whereby "tekst" one of the columns is being loaded in the dataset
In the code behind page data is loaded as as follows:
....
meetmate.DataLayer.Meetings m = new meetmate.DataLayer.Meetings();
ds = m.GetMeetingByID(meetingID);
dr = ds.Tables[0].Rows[0];
DataView dv = new DataView(ds.Tables[0]);
this.Repeater1.DataSource = dv;
this.Repeater1.DataBind();
....
The problem is that column "tekst" can be null.
In that case, I'm getting an error on
<%# Server.HtmlDecode((string)DataBinder.Eval(Container.DataItem,"tekst")) %>
because the (string) cast then goes wrong. If "tekst" is not null, it is ok.
Now this is just for "tekst", but also other columns in my table could be
null.
How can I deal with this is a nice way?
Eddy de Boer
in my aspx page I have the followong code:
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
....
<%# Server.HtmlDecode((string)DataBinder.Eval(Container.DataItem,"tekst")) %>
....
</ItemTemplate>
</asp:Repeater>
Whereby "tekst" one of the columns is being loaded in the dataset
In the code behind page data is loaded as as follows:
....
meetmate.DataLayer.Meetings m = new meetmate.DataLayer.Meetings();
ds = m.GetMeetingByID(meetingID);
dr = ds.Tables[0].Rows[0];
DataView dv = new DataView(ds.Tables[0]);
this.Repeater1.DataSource = dv;
this.Repeater1.DataBind();
....
The problem is that column "tekst" can be null.
In that case, I'm getting an error on
<%# Server.HtmlDecode((string)DataBinder.Eval(Container.DataItem,"tekst")) %>
because the (string) cast then goes wrong. If "tekst" is not null, it is ok.
Now this is just for "tekst", but also other columns in my table could be
null.
How can I deal with this is a nice way?
Eddy de Boer