Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > compositedataboundcontrol with template databinding problem

Reply
Thread Tools

compositedataboundcontrol with template databinding problem

 
 
Samuel
Guest
Posts: n/a
 
      03-23-2006
Hi everyone,

I am new to this ASP.NET 2.0 feature. I am having a hard time getting the
databinding syntax evaluated in my template for a control that inherits the
CompositeDataboundControl that is new to ASP.NET 2.0. I don't have such
problem with a control that inherits from CompositeControl. The template
loads fine, but it is just that the databinding syntax won't evaluate. Here
is how I want it done:


<cc2:TableHeader2 ID="TableHeader2" runat="server"
EnableViewState="false" AutoPostBack="false" >

<ButtonSeparatorTemplate><hr width="<%# Container.SeparatorWidth
%>" /></ButtonSeparatorTemplate>

</cc2:TableHeader2>

As you can see from the above code, there is a template called
ButtonSeparatorTemplate. On the HTML source, I only get <hr width="" />
without the Container.SeparatorWidth being evaluated.

In this class, I override the CreateChildControls (IEnumerable, Boolean)
function and I don't know what I missed. There is not such problem when I
inherits the more general CompositeControl.

Thanks!
 
Reply With Quote
 
 
 
 
Samuel
Guest
Posts: n/a
 
      03-23-2006
I just want to add that databinding syntax is evaluated without any problem
on the control itself.

<cc2:TableHeader2 ID="TableHeader2" runat="server"
EnableViewState="false" width="<%# myWidth %>" >

<ButtonSeparatorTemplate><hr width="<%# Container.SeparatorWidth
%>" /></ButtonSeparatorTemplate>

</cc2:TableHeader2>

While <%# myWidth %> evaluates without any problem, I can't get <%#
Container.SeparatorWidth %> evaluated.

Thanks for any help you can provide me.

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      03-24-2006
Hello,

Welcome to the MSDN newsgroup.

As for the custom webcontrol with Template, are you going to develop
template databound control like repeater, datalist ...? Based on my
understanding template databound control is abit different from normal
template control. Here is a msdn tech article ddemonstrate on creating a
template databound control(repeater like):

#Building DataBound Templated Custom ASP.NET Server Controls
http://msdn.microsoft.com/library/en...emplatedcontro
ls.asp?frame=true

also, the msdn doc also provide a sample control derived from
CompsoteDataBoundControl, we can also have a look.

#CompositeDataBoundControl Class
http://msdn2.microsoft.com/en-us/lib...rols.composite
databoundcontrol(VS.80).aspx


Hope this helps.

Regards,


Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may

learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.

 
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
CompositeDataBoundControl doesn't retreive it's state information. Umut Tezduyar ASP .Net 2 07-06-2006 04:33 AM
control inheriting from CompositeDataBoundControl doesn't retreive it's state information. Umut Tezduyar ASP .Net 0 07-02-2006 03:01 AM
control inheriting from CompositeDataBoundControl doesn't retreive it's state information. Umut Tezduyar ASP .Net 0 06-29-2006 08:11 PM
ASP.NET 2.0: problem with CompositeDataboundControl and GetSampleDataSource Jos ASP .Net Building Controls 1 08-17-2005 11:56 AM
ASP.NET 2.0: problem with CompositeDataboundControl and GetSampleDataSource Jos ASP .Net Web Controls 0 08-17-2005 09:31 AM



Advertisments