What I am attempting to-do is pass a DataSet to my control to handle
generating the columns from a property.
I also want to use this same DataSet to handle sorting and paging within the
control.
This is the code I was attempting to use. I could not pass a DataSet to
createGrid because the namespace will not allow System.Data.
public void createGrid(object ds,DataGrid oGrid)
{
if(_datafieldsarray == null)
{ // Write Bound Columns automatically.
for (int i = 0; i < ds; i++)
{
}
}
else
{ // Write Bound Columns from _datafieldsarray value.
arrFields = _datafieldsarray.Split(',');
for (int i = 0; i < arrFields.Length; i++)
{
BoundColumn oCol = new BoundColumn();
oCol.HeaderText = arrFields
;
oCol.DataField = arrFields;
oCol.SortExpression = arrFields;
oGrid.Columns.Add(oCol);
}
}
}
// Value would look like "FirstName,LastName"
private String _datafieldsarray;
[Category("_Custom SportPal")]
public String DataFieldsArray
{
get { return _datafieldsarray; }
set { _datafieldsarray = value; }
}
Thanks
Brian K. Williams
Suresh said:
You can pass data into a custom web control via properties or thru a
method that accepts data as a parameters during runtime.