SQLDataSource Control Timeout Property RRS feed

  • Question

  • User-503550342 posted

    How do you prevent a aspx webform / sqldatasourch control to not time out after 30 seconds?  The SQLDataSource Control placed on a aspx page has a default time-out of 30.

    I thought it was: (CacheDuration)

    <asp:SqlDataSource id="Test" CacheDuration="Infinite" runat="server" ConnectionString="<%$ ConnectionStrings:TestConnectionString %>" SelectCommand="SP_Test" SelectCommandType="StoredProcedure">


    <asp:Parameter DefaultValue="UNV" Name="DropDownList1" Type="String" />



    Thursday, September 29, 2011 12:42 PM


  • User3866881 posted



    No you are wrong. "CatchDuration" means how long you want to save the data contents into memory and directly take the data contents from the memory instead of doing searching from db and fetch data and show them onto the GridView. So it's nothing to do with Timeout.

    See MSDN at: http://msdn.microsoft.com/en-au/library/system.web.ui.webcontrols.sqldatasource.cacheduration(v=VS.80).aspx

    You can set the select command's timeout value in SqlDataSource's Selecting

    protected void SqlDataSource1_Selecting(object sender,
    SqlDataSourceSelectingEventArgs e)
    e.Command.CommandTimeout = 30;  //or more time....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 30, 2011 8:52 PM