GridWeb DataMember


#1

I've created a SQL Data Source on my ASPX page. I'm using SQL Server as my database.

I added a GridWeb to my page and used the Worksheet Designer to set the data source as the one I created above. When I try to set the data members, there is nothing in the drop down list. Is there something else that needs to be done here?

This is the code for my SQL Data Source:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:cvmartConnectionString %>"

SelectCommand="SELECT * FROM Product"></asp:SqlDataSource>

And here is part of the code for the grid:

<WebWorksheets>

<agw:Worksheet runat="server" DataMember="" DataSource="<%# SqlDataSource1 %>" Name="Sheet1">

</agw:Worksheet>

Thanks

Lisa


#2

Hi Lisa,

Currently the Aspose.Grid.Web 's Worksheets Designer doesn't work with the DataSourceControl(SqlDataSource, AccessDataSource and ObjectDataSource) of the .net 2.0. You should bind the grid to the datasource at runtime. Here is the code sample:

if (!IsPostBack)
{
DataSourceSelectArguments arg = new DataSourceSelectArguments();
IEnumerable ds = SqlDataSource1.Select(arg);
WebWorksheet sheet = GridWeb1.WebWorksheets[0];
sheet.DataSource = ds;
sheet.CreateAutoGenratedColumns();
sheet.DataBind();
}
And you can use DataSet to bind. Please read the online document:

http://www.aspose.com/Wiki/default.aspx/Aspose.Grid/BindingSheetRunTime.html

We are working at supporting Binding Features for Worksheets Designer in .net 2.0. It will be available soon.

Thank you for considering our product.

Henry