Reputation: 519
So I am currently getting a format-error (and rightfully so), because of this value. I think it is some sort of unicode space-alternative or something.
This is how I call the value:
int updatecount = Convert.ToInt32(row.Cells[2].Text);
This is the value while debugging:
I need the value to be numeric OR null. Did anyone have similar problems?
UPDATE: This is how I assigned the value:
<asp:BoundField ReadOnly="true" DataField="BASKET_ID" DataFormatString="" />
<asp:TemplateField HeaderText="Vertrags-Beginn">
<ItemTemplate>
<asp:TextBox runat="server" ID="STARTINGDATE" Text='<%# ((DateTime)(Eval("CONTRACT_POS_START"))).ToShortDateString() %>'>
</asp:TextBox><ajaxToolkit:CalendarExtender runat="server" Format="dd.MM.yyyy" ID="startingdatecalendar" TargetControlID="STARTINGDATE" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Anzahl Tage" DataField="DAYCOUNT" />
CODE BEHIND
Basket_Grid.DataSource = cdbe.VwBaskets.ToList();
Basket_Grid.DataBind();
Upvotes: 0
Views: 3495
Reputation: 4591
try something like this
int updatecount = ( IsNumeric(String.row.Cells[2].Text) ? Convert.ToInt32(String.row.Cells[2].Text) : 0 );
Upvotes: 1
Reputation: 1928
try HtmlDecode
It will convert string that has been HTML-encoded for html transmission into decoded string.
int updatecount = Convert.ToInt32(Server.HtmlDecode(row.Cells[2].Text));
Or
int updatecount = Convert.ToInt32(row.Cells[2].Replace(" ", ""));
Upvotes: 3