Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > datalist does not bind under pageview

Reply
Thread Tools

datalist does not bind under pageview

 
 
mato
Guest
Posts: n/a
 
      02-19-2004
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" ... >
<iewcageView id="page1">
<cc1:CategoryTreeView id="categoryTree" runat="server" >
</cc1:CategoryTreeView>
</iewcageView>
<iewcageView id="page2">
<aspataList id="data1" runat="server" >
<ItemTemplate>
<cc1ropertyGroupDataList id="propertyGroup1"
runat="server" PropertySessionId='<%#
DataBinder.Eval(Container.DataItem,"propertySessio nId") %>' Expanded="true"
PropertyGroupName='<%#
DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
</cc1ropertyGroupDataList>
</ItemTeplate>
</aspataList>
</iewcageView>

<aspataList id="data2" runat="server" >
<ItemTemplate>
<cc1ropertyGroupDataList id="propertyGroup2"
runat="server" PropertySessionId='<%#
DataBinder.Eval(Container.DataItem,"propertySessio nId") %>' Expanded="true"
PropertyGroupName='<%#
DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
</cc1ropertyGroupDataList>
</ItemTeplate>
</aspataList>

.......


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


 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-19-2004
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" ... >
> <iewcageView id="page1">
> <cc1:CategoryTreeView id="categoryTree" runat="server" >
> </cc1:CategoryTreeView>
> </iewcageView>
> <iewcageView id="page2">
> <aspataList id="data1" runat="server" >
> <ItemTemplate>
> <cc1ropertyGroupDataList id="propertyGroup1"
> runat="server" PropertySessionId='<%#
> DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'

Expanded="true"
> PropertyGroupName='<%#
> DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> </cc1ropertyGroupDataList>
> </ItemTeplate>
> </aspataList>
> </iewcageView>
>
> <aspataList id="data2" runat="server" >
> <ItemTemplate>
> <cc1ropertyGroupDataList id="propertyGroup2"
> runat="server" PropertySessionId='<%#
> DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'

Expanded="true"
> PropertyGroupName='<%#
> DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> </cc1ropertyGroupDataList>
> </ItemTeplate>
> </aspataList>
>
> ......
>
>
> 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
>
>



 
Reply With Quote
 
 
 
 
mato
Guest
Posts: n/a
 
      02-19-2004
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" ... >
> > <iewcageView id="page1">
> > <cc1:CategoryTreeView id="categoryTree" runat="server" >
> > </cc1:CategoryTreeView>
> > </iewcageView>
> > <iewcageView id="page2">
> > <aspataList id="data1" runat="server" >
> > <ItemTemplate>
> > <cc1ropertyGroupDataList id="propertyGroup1"
> > runat="server" PropertySessionId='<%#
> > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'

> Expanded="true"
> > PropertyGroupName='<%#
> > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > </cc1ropertyGroupDataList>
> > </ItemTeplate>
> > </aspataList>
> > </iewcageView>
> >
> > <aspataList id="data2" runat="server" >
> > <ItemTemplate>
> > <cc1ropertyGroupDataList id="propertyGroup2"
> > runat="server" PropertySessionId='<%#
> > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'

> Expanded="true"
> > PropertyGroupName='<%#
> > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > </cc1ropertyGroupDataList>
> > </ItemTeplate>
> > </aspataList>
> >
> > ......
> >
> >
> > 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
> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-19-2004
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" ... >
> > > <iewcageView id="page1">
> > > <cc1:CategoryTreeView id="categoryTree" runat="server" >
> > > </cc1:CategoryTreeView>
> > > </iewcageView>
> > > <iewcageView id="page2">
> > > <aspataList id="data1" runat="server" >
> > > <ItemTemplate>
> > > <cc1ropertyGroupDataList id="propertyGroup1"
> > > runat="server" PropertySessionId='<%#
> > > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'

> > Expanded="true"
> > > PropertyGroupName='<%#
> > > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > > </cc1ropertyGroupDataList>
> > > </ItemTeplate>
> > > </aspataList>
> > > </iewcageView>
> > >
> > > <aspataList id="data2" runat="server" >
> > > <ItemTemplate>
> > > <cc1ropertyGroupDataList id="propertyGroup2"
> > > runat="server" PropertySessionId='<%#
> > > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'

> > Expanded="true"
> > > PropertyGroupName='<%#
> > > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > > </cc1ropertyGroupDataList>
> > > </ItemTeplate>
> > > </aspataList>
> > >
> > > ......
> > >
> > >
> > > 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
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
mato
Guest
Posts: n/a
 
      02-20-2004
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" ... >
> > > > <iewcageView id="page1">
> > > > <cc1:CategoryTreeView id="categoryTree" runat="server" >
> > > > </cc1:CategoryTreeView>
> > > > </iewcageView>
> > > > <iewcageView id="page2">
> > > > <aspataList id="data1" runat="server" >
> > > > <ItemTemplate>
> > > > <cc1ropertyGroupDataList id="propertyGroup1"
> > > > runat="server" PropertySessionId='<%#
> > > > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'
> > > Expanded="true"
> > > > PropertyGroupName='<%#
> > > > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > > > </cc1ropertyGroupDataList>
> > > > </ItemTeplate>
> > > > </aspataList>
> > > > </iewcageView>
> > > >
> > > > <aspataList id="data2" runat="server" >
> > > > <ItemTemplate>
> > > > <cc1ropertyGroupDataList id="propertyGroup2"
> > > > runat="server" PropertySessionId='<%#
> > > > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'
> > > Expanded="true"
> > > > PropertyGroupName='<%#
> > > > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > > > </cc1ropertyGroupDataList>
> > > > </ItemTeplate>
> > > > </aspataList>
> > > >
> > > > ......
> > > >
> > > >
> > > > 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
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
mato
Guest
Posts: n/a
 
      02-20-2004
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" ... >
> > > > <iewcageView id="page1">
> > > > <cc1:CategoryTreeView id="categoryTree" runat="server" >
> > > > </cc1:CategoryTreeView>
> > > > </iewcageView>
> > > > <iewcageView id="page2">
> > > > <aspataList id="data1" runat="server" >
> > > > <ItemTemplate>
> > > > <cc1ropertyGroupDataList id="propertyGroup1"
> > > > runat="server" PropertySessionId='<%#
> > > > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'
> > > Expanded="true"
> > > > PropertyGroupName='<%#
> > > > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > > > </cc1ropertyGroupDataList>
> > > > </ItemTeplate>
> > > > </aspataList>
> > > > </iewcageView>
> > > >
> > > > <aspataList id="data2" runat="server" >
> > > > <ItemTemplate>
> > > > <cc1ropertyGroupDataList id="propertyGroup2"
> > > > runat="server" PropertySessionId='<%#
> > > > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'
> > > Expanded="true"
> > > > PropertyGroupName='<%#
> > > > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > > > </cc1ropertyGroupDataList>
> > > > </ItemTeplate>
> > > > </aspataList>
> > > >
> > > > ......
> > > >
> > > >
> > > > 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
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-20-2004
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" ... >
> > > > > <iewcageView id="page1">
> > > > > <cc1:CategoryTreeView id="categoryTree" runat="server"

>
> > > > > </cc1:CategoryTreeView>
> > > > > </iewcageView>
> > > > > <iewcageView id="page2">
> > > > > <aspataList id="data1" runat="server" >
> > > > > <ItemTemplate>
> > > > > <cc1ropertyGroupDataList id="propertyGroup1"
> > > > > runat="server" PropertySessionId='<%#
> > > > > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'
> > > > Expanded="true"
> > > > > PropertyGroupName='<%#
> > > > > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > > > > </cc1ropertyGroupDataList>
> > > > > </ItemTeplate>
> > > > > </aspataList>
> > > > > </iewcageView>
> > > > >
> > > > > <aspataList id="data2" runat="server" >
> > > > > <ItemTemplate>
> > > > > <cc1ropertyGroupDataList id="propertyGroup2"
> > > > > runat="server" PropertySessionId='<%#
> > > > > DataBinder.Eval(Container.DataItem,"propertySessio nId") %>'
> > > > Expanded="true"
> > > > > PropertyGroupName='<%#
> > > > > DataBinder.Eval(Container.DataItem,"propertyGroupN ame") %>' >
> > > > > </cc1ropertyGroupDataList>
> > > > > </ItemTeplate>
> > > > > </aspataList>
> > > > >
> > > > > ......
> > > > >
> > > > >
> > > > > 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
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you bind a datalist that is inside a bound datalist =?Utf-8?B?QVNQIERldmVsb3Blcg==?= ASP .Net 2 09-26-2006 02:18 AM
Tabstrip and position and formatting multipage pageview gce ASP .Net 0 03-30-2005 08:52 AM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
HOW TO: showing datagrid in multipage (pageview) RedEagle ASP .Net 0 08-20-2004 10:16 AM
WebControls: TabStrip, MultiPage, PageView szabelin ASP .Net 1 08-20-2003 07:24 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57