Last post Apr 28, 2020 04:44 AM by sking
Apr 27, 2020 02:21 AM|sking|LINK
There is no space character in my table. I'm not putting a in my code. It's not in my page for DateSenttoProcessor:
<asp:BoundField DataField="DateSenttoProcessor" HeaderText="Sent to Processor" ReadOnly="True"
SortExpression="DateSenttoProcessor" ItemStyle-HorizontalAlign="Right" />
So why when I am debugging and I hover my mouse over e.row.cells(4) there is a &nbdsp; messing up what I'm trying to do. My table value is NULL at the moment
I'm trying to replace the empty cell with the words Not sent and also disable the checkbox on the row. Why does the program generate the ?
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim Senttoprocessor As String = e.Row.Cells(4).Text
Dim Senttoprocesso3r As String = e.Row.Cells(3).Text
If Senttoprocessor = "" Then
e.Row.Cells(4).Text = "Not sent"
e.Row.Cells(1).Enabled = False 'Diable the checkbox
Apr 27, 2020 09:19 AM|PatriceSc|LINK
It could be an old trick to properly render empty cells. See what happens if you try:
If Sentroprocessor=" " Then
Not directly related but I try to always render controls based on source data (possibly adding extra properties or computed columns) rather than reading back "data" from the rendered markup.
Apr 27, 2020 09:59 AM|KathyW|LINK
Back in the day, empty table cells with nothing in them would be handled differently by browsers (regarding borders) from table cells with a space in them. As a result GridView puts in empty table cells, so people are not surprised with unexpected
border behavior. I don't think that is still an issue with modern browsers, but that is how the GridView works.
You'll need to assume it will happen and adjust your code to handle it
Apr 28, 2020 04:44 AM|sking|LINK
Thanks Kathy. I have adjust my code to handle this issue.
If Senttoprocessor = Nothing Or Senttoprocessor = " " Or Senttoprocessor = "Not sent" Then