none
Error en gridview (Asp.Net y C#) RRS feed

  • Pregunta

  • Buenos días estimados, me sale el siguiente error:

    System.Web.HttpException was unhandled by user code
      Message=The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'SqlBiblioteca' could not be found.
      Source=System.Web
      ErrorCode=-2147467259
      WebEventCode=0
      StackTrace:
           at System.Web.UI.WebControls.DataBoundControl.GetDataSource()
           at System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView()
           at System.Web.UI.WebControls.DataBoundControl.GetData()
           at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
           at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
           at System.Web.UI.WebControls.GridView.DataBind()
           at Page01.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\xxxxx\Mis documentos\Visual Studio 2010\WebSites\CarroDeCompras\Page01.aspx.cs:line 21
           at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
           at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
           at System.Web.UI.Control.OnLoad(EventArgs e)
           at System.Web.UI.Control.LoadRecursive()
           at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      InnerException: 

    El código del problema es el siguiente:

    Detalle del navegador:

    Server Error in '/CarroDeCompras' Application.

    The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'SqlBiblioteca' could not be found.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Web.HttpException: The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'SqlBiblioteca' could not be found.

    Source Error: 
    Line 19:             //Listar
    Line 20:             GridView1.DataSource = p.listado();
    Line 21:             GridView1.DataBind();
    Line 22:         }
    Line 23:     }

    Source File: c:\Documents and Settings\maquino\Mis documentos\Visual Studio 2010\WebSites\CarroDeCompras\Page01.aspx.cs    Line: 21 

    Stack Trace: 
    [HttpException (0x80004005): The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'SqlBiblioteca' could not be found.]
       System.Web.UI.WebControls.DataBoundControl.GetDataSource() +1803924
       System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +159
       System.Web.UI.WebControls.DataBoundControl.GetData() +4
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +59
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
       System.Web.UI.WebControls.GridView.DataBind() +4
       Page01.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\xxxx\Mis documentos\Visual Studio 2010\WebSites\CarroDeCompras\Page01.aspx.cs:21
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
       System.Web.UI.Control.OnLoad(EventArgs e) +91
       System.Web.UI.Control.LoadRecursive() +74
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

    Que puede ser el error?

    Muchas gracias por destinar tiempo en mi pregunta. Saludos.

    lunes, 1 de julio de 2013 16:10

Respuestas