MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Trying to add gridview on homepage but getting error  (Mono Support )

Viewed 3642 time(s), 3 post(s) 5/7/2014 3:31:06 PMby super
super

super

5/7/2014 3:31:06 PM
I am trying to add a gridview on the homepage but getting error.

This is my gridview (I do not see any problem with the code):

<div class="side-content">
 
        <portal:PortalWebPartZoneTableless ID="topPartZone" runat="server" Width="100%" ChromeTemplateFile="Standard.htm" HeaderText='<%$ Code: PageResources.Zone_TopPartZone %>'>
         
            <ZoneTemplate>
 
 
           
            <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource2"></asp:GridView>
                  <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:LocalSqlServer %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM BlogPost">
            
        </asp:SqlDataSource>



This is the error I am getting in log (homepage is throwing ERROR):

014-05-07 11:29:49,871 [25] ERROR MonoX [::1] - Error
System.Web.HttpException (0x80004005): The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'SqlDataSource2' could not be found.
   at System.Web.UI.WebControls.DataBoundControl.GetDataSource()
   at System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView()
   at System.Web.UI.WebControls.DataBoundControl.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)



need help?
This content has not been rated yet. 
6018 Reputation 709 Total posts
dbogdan

dbogdan

5/8/2014 9:03:11 AM
Hi Super,

Unfortunately this problem is not connected to the MonoX platform.
Please try to follow this tutorial: ASP GridView, but besides that you can find a bunch of other tutorials and examples on the MSDN support, or stackoverflow.

Regards,
Darjan


This content has not been rated yet. 
231 Reputation 38 Total posts
vzakanj

vzakanj

5/12/2014 9:02:57 AM
Hi Super,
the reason this is not working is because you're using regular controls directly in the PortalWebPartZoneTableless which is meant to only hold web parts. If you want to have such structure you should wrap your grid view and the sqldatasource inside a web part and then place the web part inside the ZoneTemplate tags.
This content has not been rated yet. 
345 Reputation 61 Total posts