Sign up ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.

How can I cancel selecting rows in SqlDataSource when SelectCommandtimed out?
I know that I can set CommandTimeout property but I want to Handle error and force Page to continue running when SqlDataSource timed out.

for more information:
in my page, a ListView use SqlDataSource result but this result is not my main content and just recommendation similar list for main content.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I found the solution: after Selecting timed out, SqlDataSource Selected event start running.

Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Selected
    If e.Exception is nothing=false andalso e.Exception.InnerException.ToString.ToLower.Contains("timed out") Then
        ListView1.Visible = False
        e.ExceptionHandled = True
    End If
End Sub
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.