M
microsoft.public
I have a custom control that inherited the DataList. What I want is for the
code on the aspx page to make the following call:
CustomDataList.CategoryID = 1
The control uses this property to filter the data it displays. The control
handles getting the data itself. The code I have in the control is:
Catalog cat = new Catalog();
DataSet ds = cat.GetCatalog();
DataView dv = new DataView(ds.Tables[0]);
dv.RowFilter = "CategoryID = " + _catid;
base.DataSource = dv;
base.DataBind();
The problem I'm having is that if I put this code in the constructor (New)
the property value (_catid) is not set yet, but if I put this code anywhere
else the control won't display the data (The data is being retrieved ok,
just not displayed). I've tried a bunch of combinations but none worked.
Which event should this code be in to work? Also am I correct in setting the
base. properies? I've tried it to this. and same thing. None of the many
examples I've looked at show a solution. Thanks!
MikeH
code on the aspx page to make the following call:
CustomDataList.CategoryID = 1
The control uses this property to filter the data it displays. The control
handles getting the data itself. The code I have in the control is:
Catalog cat = new Catalog();
DataSet ds = cat.GetCatalog();
DataView dv = new DataView(ds.Tables[0]);
dv.RowFilter = "CategoryID = " + _catid;
base.DataSource = dv;
base.DataBind();
The problem I'm having is that if I put this code in the constructor (New)
the property value (_catid) is not set yet, but if I put this code anywhere
else the control won't display the data (The data is being retrieved ok,
just not displayed). I've tried a bunch of combinations but none worked.
Which event should this code be in to work? Also am I correct in setting the
base. properies? I've tried it to this. and same thing. None of the many
examples I've looked at show a solution. Thanks!
MikeH