datalist does not bind under pageview

M

mato

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
 
A

Alessandro Zifiglio

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.
 
M

mato

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 said:
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 said:
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
 
A

Alessandro Zifiglio

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 said:
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 said:
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 said:
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
 
M

mato

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 said:
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 said:
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 said:
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.

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
 
M

mato

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 said:
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 said:
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 said:
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.

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
 
A

Alessandro Zifiglio

lol mato. I've been there myself. ;)
mato said:
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 said:
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
problem
is
a either
you the
same
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
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top