datalist does not bind under pageview

Discussion in 'ASP .Net Web Controls' started by mato, Feb 19, 2004.

  1. mato

    mato Guest

    hello!
    i have this problem. i put datalist control under pageview, and the same
    datalist on the page.
    when it is placed under pageview, it does not bind, on the page works fine.

    this is piece of my aspx code.

    .....
    <iewc:Multipage id="someId" runat="server" ... >
    <iewc:pageView id="page1">
    <cc1:CategoryTreeView id="categoryTree" runat="server" >
    </cc1:CategoryTreeView>
    </iewc:pageView>
    <iewc:pageView id="page2">
    <asp:DataList id="data1" runat="server" >
    <ItemTemplate>
    <cc1:propertyGroupDataList id="propertyGroup1"
    runat="server" PropertySessionId='<%#
    DataBinder.Eval(Container.DataItem,"propertySessionId") %>' Expanded="true"
    PropertyGroupName='<%#
    DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    </cc1:propertyGroupDataList>
    </ItemTeplate>
    </asp:DataList>
    </iewc:pageView>

    <asp:DataList id="data2" runat="server" >
    <ItemTemplate>
    <cc1:propertyGroupDataList id="propertyGroup2"
    runat="server" PropertySessionId='<%#
    DataBinder.Eval(Container.DataItem,"propertySessionId") %>' Expanded="true"
    PropertyGroupName='<%#
    DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    </cc1:propertyGroupDataList>
    </ItemTeplate>
    </asp:DataList>

    .......


    c# page behind code.
    public class MyWebPage : System.Web.UI.Page
    {
    ....
    private void MyWebPage_PageLoad(object sender, System.EventArgs e)
    {
    BindDataList();
    }

    private void BindDataList()
    {
    System.Data.DataView _view = CreateDataSource();
    data1.DataSource = _view;
    data1.DataBind();

    data2.DataSource = _view;
    data2.DataBind();
    }
    ....
    }

    c# custom control code:
    public class PropertyGroupName : System.Web.UI.WebControls.DataList
    {
    ....

    [ System.ComponentModel.Bindable( true ) ]
    public PropertySessionId
    {
    get
    {
    ...
    }
    set
    {
    ...
    }
    }

    [ System.ComponentModel.Bindable( true ) ]
    public PropertyGroupName
    {
    get
    {
    ...
    }
    set
    {
    ...
    }
    }
    ....
    }


    thank you for any comment, suggestion, help, opinion, anything
     
    mato, Feb 19, 2004
    #1
    1. Advertising

  2. hi mato, the reason you are unable to bind to the datalist when it is a
    child control is because you "It is a childcontrol to pageview, either you
    get a reference to your datalist through page view using the fincontrol
    method or just simply add your datalist to a usercontrol and do the binding
    in your usercontrols code behind. And then add your usercontrol as a
    childcontrol to pageview. This way you get direct access to your datalist
    from the usercontrols codebehind directly. Also simplifies a lot of things
    for you.

    "mato" <> wrote in message
    news:...
    > hello!
    > i have this problem. i put datalist control under pageview, and the same
    > datalist on the page.
    > when it is placed under pageview, it does not bind, on the page works

    fine.
    >
    > this is piece of my aspx code.
    >
    > ....
    > <iewc:Multipage id="someId" runat="server" ... >
    > <iewc:pageView id="page1">
    > <cc1:CategoryTreeView id="categoryTree" runat="server" >
    > </cc1:CategoryTreeView>
    > </iewc:pageView>
    > <iewc:pageView id="page2">
    > <asp:DataList id="data1" runat="server" >
    > <ItemTemplate>
    > <cc1:propertyGroupDataList id="propertyGroup1"
    > runat="server" PropertySessionId='<%#
    > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'

    Expanded="true"
    > PropertyGroupName='<%#
    > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > </cc1:propertyGroupDataList>
    > </ItemTeplate>
    > </asp:DataList>
    > </iewc:pageView>
    >
    > <asp:DataList id="data2" runat="server" >
    > <ItemTemplate>
    > <cc1:propertyGroupDataList id="propertyGroup2"
    > runat="server" PropertySessionId='<%#
    > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'

    Expanded="true"
    > PropertyGroupName='<%#
    > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > </cc1:propertyGroupDataList>
    > </ItemTeplate>
    > </asp:DataList>
    >
    > ......
    >
    >
    > c# page behind code.
    > public class MyWebPage : System.Web.UI.Page
    > {
    > ....
    > private void MyWebPage_PageLoad(object sender, System.EventArgs e)
    > {
    > BindDataList();
    > }
    >
    > private void BindDataList()
    > {
    > System.Data.DataView _view = CreateDataSource();
    > data1.DataSource = _view;
    > data1.DataBind();
    >
    > data2.DataSource = _view;
    > data2.DataBind();
    > }
    > ....
    > }
    >
    > c# custom control code:
    > public class PropertyGroupName : System.Web.UI.WebControls.DataList
    > {
    > ....
    >
    > [ System.ComponentModel.Bindable( true ) ]
    > public PropertySessionId
    > {
    > get
    > {
    > ...
    > }
    > set
    > {
    > ...
    > }
    > }
    >
    > [ System.ComponentModel.Bindable( true ) ]
    > public PropertyGroupName
    > {
    > get
    > {
    > ...
    > }
    > set
    > {
    > ...
    > }
    > }
    > ....
    > }
    >
    >
    > thank you for any comment, suggestion, help, opinion, anything
    >
    >
     
    Alessandro Zifiglio, Feb 19, 2004
    #2
    1. Advertising

  3. mato

    mato Guest

    hello alessandro.
    thank you for your interest.
    my problem is not that i can not get reference to datalist. the problem is
    in binding.
    let me explain, how i create this control hierarchy ( every step is in
    design time ):
    1. i put multipage control from toolbar at design time.
    2. then i add 2 pages.
    3. on first page i add my first custom control ( CategoryTreeView )
    4. on second page i add asp net dataList control
    5. on page i add my second custom control ( PropertyGroupDataList )
    6. then i create some dataBinding to 2 properties on
    PropertyGroupDataList ( PropertySessionId and PropertyGroupName )
    7. then i start template editing of items on dataList control
    8. add my custom PropertyGroupDataList with dataBindings to item
    template
    9. stop template editig

    now i added some behind code. like createDataView ( create table, add two
    columns, then add some rows with values set ).
    then do DataBind() on dataList. The problem is that if i put this dataList
    under PageView it does not bind to PropertySessionId and PropertyGroupName
    properties. when it is placed on the page ( the same control, the same
    bindings ) it works fine.

    but maybe i misunderstand what you wrote.

    "Alessandro Zifiglio" <> wrote in
    message news:1S4Zb.9181$...
    > hi mato, the reason you are unable to bind to the datalist when it is a
    > child control is because you "It is a childcontrol to pageview, either you
    > get a reference to your datalist through page view using the fincontrol
    > method or just simply add your datalist to a usercontrol and do the

    binding
    > in your usercontrols code behind. And then add your usercontrol as a
    > childcontrol to pageview. This way you get direct access to your datalist
    > from the usercontrols codebehind directly. Also simplifies a lot of things
    > for you.
    >
    > "mato" <> wrote in message
    > news:...
    > > hello!
    > > i have this problem. i put datalist control under pageview, and the same
    > > datalist on the page.
    > > when it is placed under pageview, it does not bind, on the page works

    > fine.
    > >
    > > this is piece of my aspx code.
    > >
    > > ....
    > > <iewc:Multipage id="someId" runat="server" ... >
    > > <iewc:pageView id="page1">
    > > <cc1:CategoryTreeView id="categoryTree" runat="server" >
    > > </cc1:CategoryTreeView>
    > > </iewc:pageView>
    > > <iewc:pageView id="page2">
    > > <asp:DataList id="data1" runat="server" >
    > > <ItemTemplate>
    > > <cc1:propertyGroupDataList id="propertyGroup1"
    > > runat="server" PropertySessionId='<%#
    > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'

    > Expanded="true"
    > > PropertyGroupName='<%#
    > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > </cc1:propertyGroupDataList>
    > > </ItemTeplate>
    > > </asp:DataList>
    > > </iewc:pageView>
    > >
    > > <asp:DataList id="data2" runat="server" >
    > > <ItemTemplate>
    > > <cc1:propertyGroupDataList id="propertyGroup2"
    > > runat="server" PropertySessionId='<%#
    > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'

    > Expanded="true"
    > > PropertyGroupName='<%#
    > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > </cc1:propertyGroupDataList>
    > > </ItemTeplate>
    > > </asp:DataList>
    > >
    > > ......
    > >
    > >
    > > c# page behind code.
    > > public class MyWebPage : System.Web.UI.Page
    > > {
    > > ....
    > > private void MyWebPage_PageLoad(object sender, System.EventArgs e)
    > > {
    > > BindDataList();
    > > }
    > >
    > > private void BindDataList()
    > > {
    > > System.Data.DataView _view = CreateDataSource();
    > > data1.DataSource = _view;
    > > data1.DataBind();
    > >
    > > data2.DataSource = _view;
    > > data2.DataBind();
    > > }
    > > ....
    > > }
    > >
    > > c# custom control code:
    > > public class PropertyGroupName : System.Web.UI.WebControls.DataList
    > > {
    > > ....
    > >
    > > [ System.ComponentModel.Bindable( true ) ]
    > > public PropertySessionId
    > > {
    > > get
    > > {
    > > ...
    > > }
    > > set
    > > {
    > > ...
    > > }
    > > }
    > >
    > > [ System.ComponentModel.Bindable( true ) ]
    > > public PropertyGroupName
    > > {
    > > get
    > > {
    > > ...
    > > }
    > > set
    > > {
    > > ...
    > > }
    > > }
    > > ....
    > > }
    > >
    > >
    > > thank you for any comment, suggestion, help, opinion, anything
    > >
    > >

    >
    >
     
    mato, Feb 19, 2004
    #3
  4. Ok, just tested and i were under the impression that the multipage control
    behaved like the datalist, datagrid and repeater controls in that they
    supplied their own naming scheme to child controls but this is not so.
    Please ignore my earlier post ;P

    I have just run a small test and I've been able to bind a datalist
    successfully, within a multipage control that is, so the problem remains
    within your custom control. You've also stated that this has worked nicely
    when not contained within the multipage control. At this point i have no
    idea why it is not working for you ;P

    "mato" <> wrote in message
    news:...
    > hello alessandro.
    > thank you for your interest.
    > my problem is not that i can not get reference to datalist. the problem is
    > in binding.
    > let me explain, how i create this control hierarchy ( every step is in
    > design time ):
    > 1. i put multipage control from toolbar at design time.
    > 2. then i add 2 pages.
    > 3. on first page i add my first custom control ( CategoryTreeView )
    > 4. on second page i add asp net dataList control
    > 5. on page i add my second custom control ( PropertyGroupDataList )
    > 6. then i create some dataBinding to 2 properties on
    > PropertyGroupDataList ( PropertySessionId and PropertyGroupName )
    > 7. then i start template editing of items on dataList control
    > 8. add my custom PropertyGroupDataList with dataBindings to item
    > template
    > 9. stop template editig
    >
    > now i added some behind code. like createDataView ( create table, add two
    > columns, then add some rows with values set ).
    > then do DataBind() on dataList. The problem is that if i put this dataList
    > under PageView it does not bind to PropertySessionId and PropertyGroupName
    > properties. when it is placed on the page ( the same control, the same
    > bindings ) it works fine.
    >
    > but maybe i misunderstand what you wrote.
    >
    > "Alessandro Zifiglio" <> wrote in
    > message news:1S4Zb.9181$...
    > > hi mato, the reason you are unable to bind to the datalist when it is a
    > > child control is because you "It is a childcontrol to pageview, either

    you
    > > get a reference to your datalist through page view using the fincontrol
    > > method or just simply add your datalist to a usercontrol and do the

    > binding
    > > in your usercontrols code behind. And then add your usercontrol as a
    > > childcontrol to pageview. This way you get direct access to your

    datalist
    > > from the usercontrols codebehind directly. Also simplifies a lot of

    things
    > > for you.
    > >
    > > "mato" <> wrote in message
    > > news:...
    > > > hello!
    > > > i have this problem. i put datalist control under pageview, and the

    same
    > > > datalist on the page.
    > > > when it is placed under pageview, it does not bind, on the page works

    > > fine.
    > > >
    > > > this is piece of my aspx code.
    > > >
    > > > ....
    > > > <iewc:Multipage id="someId" runat="server" ... >
    > > > <iewc:pageView id="page1">
    > > > <cc1:CategoryTreeView id="categoryTree" runat="server" >
    > > > </cc1:CategoryTreeView>
    > > > </iewc:pageView>
    > > > <iewc:pageView id="page2">
    > > > <asp:DataList id="data1" runat="server" >
    > > > <ItemTemplate>
    > > > <cc1:propertyGroupDataList id="propertyGroup1"
    > > > runat="server" PropertySessionId='<%#
    > > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'

    > > Expanded="true"
    > > > PropertyGroupName='<%#
    > > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > > </cc1:propertyGroupDataList>
    > > > </ItemTeplate>
    > > > </asp:DataList>
    > > > </iewc:pageView>
    > > >
    > > > <asp:DataList id="data2" runat="server" >
    > > > <ItemTemplate>
    > > > <cc1:propertyGroupDataList id="propertyGroup2"
    > > > runat="server" PropertySessionId='<%#
    > > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'

    > > Expanded="true"
    > > > PropertyGroupName='<%#
    > > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > > </cc1:propertyGroupDataList>
    > > > </ItemTeplate>
    > > > </asp:DataList>
    > > >
    > > > ......
    > > >
    > > >
    > > > c# page behind code.
    > > > public class MyWebPage : System.Web.UI.Page
    > > > {
    > > > ....
    > > > private void MyWebPage_PageLoad(object sender, System.EventArgs e)
    > > > {
    > > > BindDataList();
    > > > }
    > > >
    > > > private void BindDataList()
    > > > {
    > > > System.Data.DataView _view = CreateDataSource();
    > > > data1.DataSource = _view;
    > > > data1.DataBind();
    > > >
    > > > data2.DataSource = _view;
    > > > data2.DataBind();
    > > > }
    > > > ....
    > > > }
    > > >
    > > > c# custom control code:
    > > > public class PropertyGroupName : System.Web.UI.WebControls.DataList
    > > > {
    > > > ....
    > > >
    > > > [ System.ComponentModel.Bindable( true ) ]
    > > > public PropertySessionId
    > > > {
    > > > get
    > > > {
    > > > ...
    > > > }
    > > > set
    > > > {
    > > > ...
    > > > }
    > > > }
    > > >
    > > > [ System.ComponentModel.Bindable( true ) ]
    > > > public PropertyGroupName
    > > > {
    > > > get
    > > > {
    > > > ...
    > > > }
    > > > set
    > > > {
    > > > ...
    > > > }
    > > > }
    > > > ....
    > > > }
    > > >
    > > >
    > > > thank you for any comment, suggestion, help, opinion, anything
    > > >
    > > >

    > >
    > >

    >
    >
     
    Alessandro Zifiglio, Feb 19, 2004
    #4
  5. mato

    mato Guest

    thank you very much for taking that test.
    at least i know that the problem is somewhere in my aspx code, because some
    things
    i had changed manually. i better recreate the page again.
    have a nice day and thank you again.

    "Alessandro Zifiglio" <> wrote in
    message news:J46Zb.9205$...
    > Ok, just tested and i were under the impression that the multipage control
    > behaved like the datalist, datagrid and repeater controls in that they
    > supplied their own naming scheme to child controls but this is not so.
    > Please ignore my earlier post ;P
    >
    > I have just run a small test and I've been able to bind a datalist
    > successfully, within a multipage control that is, so the problem remains
    > within your custom control. You've also stated that this has worked nicely
    > when not contained within the multipage control. At this point i have no
    > idea why it is not working for you ;P
    >
    > "mato" <> wrote in message
    > news:...
    > > hello alessandro.
    > > thank you for your interest.
    > > my problem is not that i can not get reference to datalist. the problem

    is
    > > in binding.
    > > let me explain, how i create this control hierarchy ( every step is in
    > > design time ):
    > > 1. i put multipage control from toolbar at design time.
    > > 2. then i add 2 pages.
    > > 3. on first page i add my first custom control ( CategoryTreeView )
    > > 4. on second page i add asp net dataList control
    > > 5. on page i add my second custom control ( PropertyGroupDataList )
    > > 6. then i create some dataBinding to 2 properties on
    > > PropertyGroupDataList ( PropertySessionId and PropertyGroupName )
    > > 7. then i start template editing of items on dataList control
    > > 8. add my custom PropertyGroupDataList with dataBindings to item
    > > template
    > > 9. stop template editig
    > >
    > > now i added some behind code. like createDataView ( create table, add

    two
    > > columns, then add some rows with values set ).
    > > then do DataBind() on dataList. The problem is that if i put this

    dataList
    > > under PageView it does not bind to PropertySessionId and

    PropertyGroupName
    > > properties. when it is placed on the page ( the same control, the same
    > > bindings ) it works fine.
    > >
    > > but maybe i misunderstand what you wrote.
    > >
    > > "Alessandro Zifiglio" <> wrote in
    > > message news:1S4Zb.9181$...
    > > > hi mato, the reason you are unable to bind to the datalist when it is

    a
    > > > child control is because you "It is a childcontrol to pageview, either

    > you
    > > > get a reference to your datalist through page view using the

    fincontrol
    > > > method or just simply add your datalist to a usercontrol and do the

    > > binding
    > > > in your usercontrols code behind. And then add your usercontrol as a
    > > > childcontrol to pageview. This way you get direct access to your

    > datalist
    > > > from the usercontrols codebehind directly. Also simplifies a lot of

    > things
    > > > for you.
    > > >
    > > > "mato" <> wrote in message
    > > > news:...
    > > > > hello!
    > > > > i have this problem. i put datalist control under pageview, and the

    > same
    > > > > datalist on the page.
    > > > > when it is placed under pageview, it does not bind, on the page

    works
    > > > fine.
    > > > >
    > > > > this is piece of my aspx code.
    > > > >
    > > > > ....
    > > > > <iewc:Multipage id="someId" runat="server" ... >
    > > > > <iewc:pageView id="page1">
    > > > > <cc1:CategoryTreeView id="categoryTree" runat="server" >
    > > > > </cc1:CategoryTreeView>
    > > > > </iewc:pageView>
    > > > > <iewc:pageView id="page2">
    > > > > <asp:DataList id="data1" runat="server" >
    > > > > <ItemTemplate>
    > > > > <cc1:propertyGroupDataList id="propertyGroup1"
    > > > > runat="server" PropertySessionId='<%#
    > > > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'
    > > > Expanded="true"
    > > > > PropertyGroupName='<%#
    > > > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > > > </cc1:propertyGroupDataList>
    > > > > </ItemTeplate>
    > > > > </asp:DataList>
    > > > > </iewc:pageView>
    > > > >
    > > > > <asp:DataList id="data2" runat="server" >
    > > > > <ItemTemplate>
    > > > > <cc1:propertyGroupDataList id="propertyGroup2"
    > > > > runat="server" PropertySessionId='<%#
    > > > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'
    > > > Expanded="true"
    > > > > PropertyGroupName='<%#
    > > > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > > > </cc1:propertyGroupDataList>
    > > > > </ItemTeplate>
    > > > > </asp:DataList>
    > > > >
    > > > > ......
    > > > >
    > > > >
    > > > > c# page behind code.
    > > > > public class MyWebPage : System.Web.UI.Page
    > > > > {
    > > > > ....
    > > > > private void MyWebPage_PageLoad(object sender, System.EventArgs

    e)
    > > > > {
    > > > > BindDataList();
    > > > > }
    > > > >
    > > > > private void BindDataList()
    > > > > {
    > > > > System.Data.DataView _view = CreateDataSource();
    > > > > data1.DataSource = _view;
    > > > > data1.DataBind();
    > > > >
    > > > > data2.DataSource = _view;
    > > > > data2.DataBind();
    > > > > }
    > > > > ....
    > > > > }
    > > > >
    > > > > c# custom control code:
    > > > > public class PropertyGroupName : System.Web.UI.WebControls.DataList
    > > > > {
    > > > > ....
    > > > >
    > > > > [ System.ComponentModel.Bindable( true ) ]
    > > > > public PropertySessionId
    > > > > {
    > > > > get
    > > > > {
    > > > > ...
    > > > > }
    > > > > set
    > > > > {
    > > > > ...
    > > > > }
    > > > > }
    > > > >
    > > > > [ System.ComponentModel.Bindable( true ) ]
    > > > > public PropertyGroupName
    > > > > {
    > > > > get
    > > > > {
    > > > > ...
    > > > > }
    > > > > set
    > > > > {
    > > > > ...
    > > > > }
    > > > > }
    > > > > ....
    > > > > }
    > > > >
    > > > >
    > > > > thank you for any comment, suggestion, help, opinion, anything
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    mato, Feb 20, 2004
    #5
  6. mato

    mato Guest

    hello again
    right now i carefully looked at the code and guess what i found.
    yes, i mistyped both names of properties. no wonder they did not bind.
    two days of very intensive investigation. shame on me.
    be carefull with copy & paste.

    "Alessandro Zifiglio" <> wrote in
    message news:J46Zb.9205$...
    > Ok, just tested and i were under the impression that the multipage control
    > behaved like the datalist, datagrid and repeater controls in that they
    > supplied their own naming scheme to child controls but this is not so.
    > Please ignore my earlier post ;P
    >
    > I have just run a small test and I've been able to bind a datalist
    > successfully, within a multipage control that is, so the problem remains
    > within your custom control. You've also stated that this has worked nicely
    > when not contained within the multipage control. At this point i have no
    > idea why it is not working for you ;P
    >
    > "mato" <> wrote in message
    > news:...
    > > hello alessandro.
    > > thank you for your interest.
    > > my problem is not that i can not get reference to datalist. the problem

    is
    > > in binding.
    > > let me explain, how i create this control hierarchy ( every step is in
    > > design time ):
    > > 1. i put multipage control from toolbar at design time.
    > > 2. then i add 2 pages.
    > > 3. on first page i add my first custom control ( CategoryTreeView )
    > > 4. on second page i add asp net dataList control
    > > 5. on page i add my second custom control ( PropertyGroupDataList )
    > > 6. then i create some dataBinding to 2 properties on
    > > PropertyGroupDataList ( PropertySessionId and PropertyGroupName )
    > > 7. then i start template editing of items on dataList control
    > > 8. add my custom PropertyGroupDataList with dataBindings to item
    > > template
    > > 9. stop template editig
    > >
    > > now i added some behind code. like createDataView ( create table, add

    two
    > > columns, then add some rows with values set ).
    > > then do DataBind() on dataList. The problem is that if i put this

    dataList
    > > under PageView it does not bind to PropertySessionId and

    PropertyGroupName
    > > properties. when it is placed on the page ( the same control, the same
    > > bindings ) it works fine.
    > >
    > > but maybe i misunderstand what you wrote.
    > >
    > > "Alessandro Zifiglio" <> wrote in
    > > message news:1S4Zb.9181$...
    > > > hi mato, the reason you are unable to bind to the datalist when it is

    a
    > > > child control is because you "It is a childcontrol to pageview, either

    > you
    > > > get a reference to your datalist through page view using the

    fincontrol
    > > > method or just simply add your datalist to a usercontrol and do the

    > > binding
    > > > in your usercontrols code behind. And then add your usercontrol as a
    > > > childcontrol to pageview. This way you get direct access to your

    > datalist
    > > > from the usercontrols codebehind directly. Also simplifies a lot of

    > things
    > > > for you.
    > > >
    > > > "mato" <> wrote in message
    > > > news:...
    > > > > hello!
    > > > > i have this problem. i put datalist control under pageview, and the

    > same
    > > > > datalist on the page.
    > > > > when it is placed under pageview, it does not bind, on the page

    works
    > > > fine.
    > > > >
    > > > > this is piece of my aspx code.
    > > > >
    > > > > ....
    > > > > <iewc:Multipage id="someId" runat="server" ... >
    > > > > <iewc:pageView id="page1">
    > > > > <cc1:CategoryTreeView id="categoryTree" runat="server" >
    > > > > </cc1:CategoryTreeView>
    > > > > </iewc:pageView>
    > > > > <iewc:pageView id="page2">
    > > > > <asp:DataList id="data1" runat="server" >
    > > > > <ItemTemplate>
    > > > > <cc1:propertyGroupDataList id="propertyGroup1"
    > > > > runat="server" PropertySessionId='<%#
    > > > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'
    > > > Expanded="true"
    > > > > PropertyGroupName='<%#
    > > > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > > > </cc1:propertyGroupDataList>
    > > > > </ItemTeplate>
    > > > > </asp:DataList>
    > > > > </iewc:pageView>
    > > > >
    > > > > <asp:DataList id="data2" runat="server" >
    > > > > <ItemTemplate>
    > > > > <cc1:propertyGroupDataList id="propertyGroup2"
    > > > > runat="server" PropertySessionId='<%#
    > > > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'
    > > > Expanded="true"
    > > > > PropertyGroupName='<%#
    > > > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > > > </cc1:propertyGroupDataList>
    > > > > </ItemTeplate>
    > > > > </asp:DataList>
    > > > >
    > > > > ......
    > > > >
    > > > >
    > > > > c# page behind code.
    > > > > public class MyWebPage : System.Web.UI.Page
    > > > > {
    > > > > ....
    > > > > private void MyWebPage_PageLoad(object sender, System.EventArgs

    e)
    > > > > {
    > > > > BindDataList();
    > > > > }
    > > > >
    > > > > private void BindDataList()
    > > > > {
    > > > > System.Data.DataView _view = CreateDataSource();
    > > > > data1.DataSource = _view;
    > > > > data1.DataBind();
    > > > >
    > > > > data2.DataSource = _view;
    > > > > data2.DataBind();
    > > > > }
    > > > > ....
    > > > > }
    > > > >
    > > > > c# custom control code:
    > > > > public class PropertyGroupName : System.Web.UI.WebControls.DataList
    > > > > {
    > > > > ....
    > > > >
    > > > > [ System.ComponentModel.Bindable( true ) ]
    > > > > public PropertySessionId
    > > > > {
    > > > > get
    > > > > {
    > > > > ...
    > > > > }
    > > > > set
    > > > > {
    > > > > ...
    > > > > }
    > > > > }
    > > > >
    > > > > [ System.ComponentModel.Bindable( true ) ]
    > > > > public PropertyGroupName
    > > > > {
    > > > > get
    > > > > {
    > > > > ...
    > > > > }
    > > > > set
    > > > > {
    > > > > ...
    > > > > }
    > > > > }
    > > > > ....
    > > > > }
    > > > >
    > > > >
    > > > > thank you for any comment, suggestion, help, opinion, anything
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    mato, Feb 20, 2004
    #6
  7. lol mato. I've been there myself. ;)
    "mato" <> wrote in message
    news:...
    > hello again
    > right now i carefully looked at the code and guess what i found.
    > yes, i mistyped both names of properties. no wonder they did not bind.
    > two days of very intensive investigation. shame on me.
    > be carefull with copy & paste.
    >
    > "Alessandro Zifiglio" <> wrote in
    > message news:J46Zb.9205$...
    > > Ok, just tested and i were under the impression that the multipage

    control
    > > behaved like the datalist, datagrid and repeater controls in that they
    > > supplied their own naming scheme to child controls but this is not so.
    > > Please ignore my earlier post ;P
    > >
    > > I have just run a small test and I've been able to bind a datalist
    > > successfully, within a multipage control that is, so the problem remains
    > > within your custom control. You've also stated that this has worked

    nicely
    > > when not contained within the multipage control. At this point i have no
    > > idea why it is not working for you ;P
    > >
    > > "mato" <> wrote in message
    > > news:...
    > > > hello alessandro.
    > > > thank you for your interest.
    > > > my problem is not that i can not get reference to datalist. the

    problem
    > is
    > > > in binding.
    > > > let me explain, how i create this control hierarchy ( every step is in
    > > > design time ):
    > > > 1. i put multipage control from toolbar at design time.
    > > > 2. then i add 2 pages.
    > > > 3. on first page i add my first custom control (

    CategoryTreeView )
    > > > 4. on second page i add asp net dataList control
    > > > 5. on page i add my second custom control (

    PropertyGroupDataList )
    > > > 6. then i create some dataBinding to 2 properties on
    > > > PropertyGroupDataList ( PropertySessionId and PropertyGroupName )
    > > > 7. then i start template editing of items on dataList control
    > > > 8. add my custom PropertyGroupDataList with dataBindings to item
    > > > template
    > > > 9. stop template editig
    > > >
    > > > now i added some behind code. like createDataView ( create table, add

    > two
    > > > columns, then add some rows with values set ).
    > > > then do DataBind() on dataList. The problem is that if i put this

    > dataList
    > > > under PageView it does not bind to PropertySessionId and

    > PropertyGroupName
    > > > properties. when it is placed on the page ( the same control, the same
    > > > bindings ) it works fine.
    > > >
    > > > but maybe i misunderstand what you wrote.
    > > >
    > > > "Alessandro Zifiglio" <> wrote

    in
    > > > message news:1S4Zb.9181$...
    > > > > hi mato, the reason you are unable to bind to the datalist when it

    is
    > a
    > > > > child control is because you "It is a childcontrol to pageview,

    either
    > > you
    > > > > get a reference to your datalist through page view using the

    > fincontrol
    > > > > method or just simply add your datalist to a usercontrol and do the
    > > > binding
    > > > > in your usercontrols code behind. And then add your usercontrol as a
    > > > > childcontrol to pageview. This way you get direct access to your

    > > datalist
    > > > > from the usercontrols codebehind directly. Also simplifies a lot of

    > > things
    > > > > for you.
    > > > >
    > > > > "mato" <> wrote in message
    > > > > news:...
    > > > > > hello!
    > > > > > i have this problem. i put datalist control under pageview, and

    the
    > > same
    > > > > > datalist on the page.
    > > > > > when it is placed under pageview, it does not bind, on the page

    > works
    > > > > fine.
    > > > > >
    > > > > > this is piece of my aspx code.
    > > > > >
    > > > > > ....
    > > > > > <iewc:Multipage id="someId" runat="server" ... >
    > > > > > <iewc:pageView id="page1">
    > > > > > <cc1:CategoryTreeView id="categoryTree" runat="server"

    >
    > > > > > </cc1:CategoryTreeView>
    > > > > > </iewc:pageView>
    > > > > > <iewc:pageView id="page2">
    > > > > > <asp:DataList id="data1" runat="server" >
    > > > > > <ItemTemplate>
    > > > > > <cc1:propertyGroupDataList id="propertyGroup1"
    > > > > > runat="server" PropertySessionId='<%#
    > > > > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'
    > > > > Expanded="true"
    > > > > > PropertyGroupName='<%#
    > > > > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > > > > </cc1:propertyGroupDataList>
    > > > > > </ItemTeplate>
    > > > > > </asp:DataList>
    > > > > > </iewc:pageView>
    > > > > >
    > > > > > <asp:DataList id="data2" runat="server" >
    > > > > > <ItemTemplate>
    > > > > > <cc1:propertyGroupDataList id="propertyGroup2"
    > > > > > runat="server" PropertySessionId='<%#
    > > > > > DataBinder.Eval(Container.DataItem,"propertySessionId") %>'
    > > > > Expanded="true"
    > > > > > PropertyGroupName='<%#
    > > > > > DataBinder.Eval(Container.DataItem,"propertyGroupName") %>' >
    > > > > > </cc1:propertyGroupDataList>
    > > > > > </ItemTeplate>
    > > > > > </asp:DataList>
    > > > > >
    > > > > > ......
    > > > > >
    > > > > >
    > > > > > c# page behind code.
    > > > > > public class MyWebPage : System.Web.UI.Page
    > > > > > {
    > > > > > ....
    > > > > > private void MyWebPage_PageLoad(object sender,

    System.EventArgs
    > e)
    > > > > > {
    > > > > > BindDataList();
    > > > > > }
    > > > > >
    > > > > > private void BindDataList()
    > > > > > {
    > > > > > System.Data.DataView _view = CreateDataSource();
    > > > > > data1.DataSource = _view;
    > > > > > data1.DataBind();
    > > > > >
    > > > > > data2.DataSource = _view;
    > > > > > data2.DataBind();
    > > > > > }
    > > > > > ....
    > > > > > }
    > > > > >
    > > > > > c# custom control code:
    > > > > > public class PropertyGroupName :

    System.Web.UI.WebControls.DataList
    > > > > > {
    > > > > > ....
    > > > > >
    > > > > > [ System.ComponentModel.Bindable( true ) ]
    > > > > > public PropertySessionId
    > > > > > {
    > > > > > get
    > > > > > {
    > > > > > ...
    > > > > > }
    > > > > > set
    > > > > > {
    > > > > > ...
    > > > > > }
    > > > > > }
    > > > > >
    > > > > > [ System.ComponentModel.Bindable( true ) ]
    > > > > > public PropertyGroupName
    > > > > > {
    > > > > > get
    > > > > > {
    > > > > > ...
    > > > > > }
    > > > > > set
    > > > > > {
    > > > > > ...
    > > > > > }
    > > > > > }
    > > > > > ....
    > > > > > }
    > > > > >
    > > > > >
    > > > > > thank you for any comment, suggestion, help, opinion, anything
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Alessandro Zifiglio, Feb 20, 2004
    #7
    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. szabelin
    Replies:
    1
    Views:
    1,580
    Teemu Keiski
    Aug 20, 2003
  2. RedEagle
    Replies:
    0
    Views:
    476
    RedEagle
    Aug 20, 2004
  3. gce
    Replies:
    0
    Views:
    430
  4. =?Utf-8?B?QVNQIERldmVsb3Blcg==?=

    How do you bind a datalist that is inside a bound datalist

    =?Utf-8?B?QVNQIERldmVsb3Blcg==?=, Sep 25, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    587
    =?Utf-8?B?QVNQIERldmVsb3Blcg==?=
    Sep 26, 2006
  5. elad

    Adding dynamic controls to pageview - set location

    elad, Nov 6, 2003, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    115
Loading...

Share This Page