Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to trap "Input String is not in Correct format" Exceptions while Databinding Gridview?

Reply
Thread Tools

How to trap "Input String is not in Correct format" Exceptions while Databinding Gridview?

 
 
Anjan Bhowmik
Guest
Posts: n/a
 
      03-17-2008
I am getting this exception while binding data to Gridview. I have a control
parameter that accepts a integer value from a TextBox. If i provide a
invalid value, i get that exception. But can't handle it anywhere. I tried
the ObjectDataSource's Selecting method handler, but failed.

How do i cath those exceptions befor they rise?

And Can you please provide me a link that explains the "Event Mechanism" in
details, so that i gain acurate knowledge about how, and where i should
catch exceptions.

Thnx and Best regards.

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-17-2008
the error is thrown during the databind:

try
{
grid.DataBind()
}
catch (Exception ex)
{
// do something with error
}

if you wnat the control to handle a bad parameter value and not throw an
error, then create a new control based on the existing control, and catch the
error in the property set.

-- bruce (sqlwork.com)


"Anjan Bhowmik" wrote:

> I am getting this exception while binding data to Gridview. I have a control
> parameter that accepts a integer value from a TextBox. If i provide a
> invalid value, i get that exception. But can't handle it anywhere. I tried
> the ObjectDataSource's Selecting method handler, but failed.
>
> How do i cath those exceptions befor they rise?
>
> And Can you please provide me a link that explains the "Event Mechanism" in
> details, so that i gain acurate knowledge about how, and where i should
> catch exceptions.
>
> Thnx and Best regards.
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Databinding expressions are only supported on objects that have a DataBinding event jobs ASP .Net 0 09-25-2007 11:54 PM
Gridview encoding, or how to run commands before gridview's default databinding, or, how do I disable default databinding at all? Sergei Shelukhin ASP .Net 1 11-12-2006 01:43 PM
DataGrid Custom Column Error when DataBinding "does not contain a definition for 'DataBinding'" Earl Teigrob ASP .Net Datagrid Control 1 03-01-2004 04:52 AM
correct or not correct? Dan HTML 7 10-02-2003 10:16 PM



Advertisments