Received : 2007/08/16 13:20:12
Message : I am evaluating your Grid objet and in order to finish with this I have two questions for you:
1 When I load with data in a VS2003 grid componenet I use the following code because I need to take control of the data I'll display:
strSQL = "SELECT * From tblTable"
Dim objCmd As New SqlCommand(strSQL, objConnection)
'3. Crea Data Adapters
Dim objDA As New SqlDataAdapter
objDA.SelectCommand = objCmd
'4. Poblar los data sets
Dim objDS As New DataSet
Try
objDA.Fill(objDS)
dg.DataSource = objDS
dg.DataBind()
Finally
objConnection.Close()
End Try
How I can do that with your grid, because I can't fin the property DataSource (I see it in the Grid designer but not when I can access it programatically)
2. I need to group and sumarize. For that I need to capture the first and last row the user select with the mouse. How can I receive the first and last row number selected?
1) Well Aspose.Grid.Web fully support databinding feature. you may bind data to Aspose.Grid.Web's worksheet based on any data source. The properties are there and you may use them at runtime as well, you may use WebWorksheet.DataSource and WebWorksheet.DataMemberFor reference, please check the source code of Data Binding demos in our online featured demos: Aspose.Grid Demos
if (!IsPostBack) { WebWorksheet sheet = GridWeb1.WebWorksheets[0]; // Specifies the datasource for the sheet. sheet.DataSource = dataSet11; sheet.DataMember = "Products"; // Creates in-sheet column headers Not. if you want you will in-sheet column headers set it to true. sheet.EnableCreateBindColumnHeader = false; // Data cells begin at row 1; sheet.BindStartRow = 1; // Creates the data field column automatically. sheet.CreateAutoGenratedColumns(); ...... try { // Loads data from database. db.oleDbDataAdapter1.Fill(dataSet11); } finally { db.oleDbConnection1.Close(); }
// Binding. sheet.DataBind(); }
2) I think you may use client side javascript function getSelectedCells() to obtain the selected cells and extract first and the last row from it. You may use OnSubmitClientFunction of GridWeb's property to set the javascript function for it in html. e.g., The event is fired when you data is submitted to gridweb.