Click here to Skip to main content
16,018,496 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I want to know how to catch errors in a gridview, thanks!
Posted

If you are trying to perform Adding a new record using GridView, you can handle RowInserted event handler. Then in this event handler check the e.Exception property. If it is not null then you can take appropriate actions based on the exception(Inner Exception) property.
Similary u can handle RowUpdated and RowsDeleted event handlers to handle errors when the Row is updated and deleted respectively.
 
Share this answer
 
Use try catch block
For Example:
C#
public void BindMyGrid()
{
    try
    {
      //bind grid here with datasource 
            
    }
    catch(Exception ex)
    {
     
    } 
}
 
Share this answer
 
v2
Hi,
I cant get you? what kind of errors you want to catch?
if it is relating to data binding then use try catch block,
please give proper details regarding the the issue so that it will be easier to get answer
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900