Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Databind Error not throwing an exception
posted

Greetings,

I am debugging a databind issue with WebDataGrid using Infragistics35.Web.v11.1, Version=11.1.20111.1006.

The problem was tracked down to a record with bad data in a field. It had ASCII 0 (not null but a length 1 string) in a Field that should be "Y" or "N".  We are not doing anything other than displaying data in this grid.  Even when we tested by having a button set the datasource and do the databind, we were not able to catch this error.  The application gave an asp.net error occured web page with a non-descript error.  The code below never threw an exception when binding the data, were the exception occurs.  It took hard trial and error to determine what field and then what record was causing this issue.

What is the right way catch this exception as not to crash this appliction?

Thanks,

RBB

 

 

 

 

 

 

 

 

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles

Button1.Click

Try

WebDataGrid1.DataSource = SqlDataSource1

WebDataGrid1.DataBind()

 

 

 

Catch ex As Exception

MsgBox(ex.Message.ToString,

 

MsgBoxStyle.MsgBoxSetForeground, "Binding")

 

 

 

End Try

 

 

 

End Sub

Parents Reply Children
No Data