This is a migrated thread and some comments may be shown as answers.

How do you catch a GroupByExpressions Error?

1 Answer 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 12 Apr 2011, 06:02 PM
Hi,
I'm creating a GroupBy expression dynamically based on user input:

RadGrid1.MasterTableView.GroupByExpressions.Add(txtUserInput.Text);

Occasionally the user gets this wrong which causes an error.
I simply want to catch this error in a try/catch block and handle it, but I'm not sure where to put the try/catch.
Any help would be appreciated.
Thanks,
Nick

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 18 Apr 2011, 08:25 AM
Hi Nick,

You can wrap the snippet of code where you add the group by expression with a try-catch block:

try
{
    RadGrid1.MasterTableView.GroupByExpressions.Add(txtUserInput.Text);
    RadGrid1.Rebind();
}
catch (Exception ex)
{
    Label1.Text = "Error: " + ex.Message;
}


Veli
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Nick
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or