Custom property in inherited control & databinding

  • Thread starter microsoft.public
  • Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top