Custom property in inherited control & databinding

Discussion in 'ASP .Net Web Controls' started by microsoft.public, Nov 5, 2004.

  1. 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
     
    microsoft.public, Nov 5, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SW1hciBTcGFhbmphYXJz?=

    Databinding to custom properties of a custom class in ASP.NET 2

    =?Utf-8?B?SW1hciBTcGFhbmphYXJz?=, Apr 20, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    596
    =?Utf-8?B?SW1hciBTcGFhbmphYXJz?=
    Apr 20, 2005
  2. Nathan Sokalski
    Replies:
    1
    Views:
    434
    Cor Ligthert
    Mar 17, 2009
  3. Earl Teigrob
    Replies:
    1
    Views:
    423
    Shravan
    Mar 1, 2004
  4. Nathan Sokalski

    Control is not showing inherited properties in property grid

    Nathan Sokalski, Mar 15, 2009, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    854
    Cor Ligthert
    Mar 17, 2009
  5. 7stud --
    Replies:
    11
    Views:
    430
    7stud --
    Nov 9, 2007
Loading...

Share This Page