Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / March 2006

Tip: Looking for answers? Try searching our database.

compositedataboundcontrol with template databinding problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Samuel - 23 Mar 2006 12:30 GMT
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!
Samuel - 23 Mar 2006 12:54 GMT
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.
Steven Cheng[MSFT] - 24 Mar 2006 06:06 GMT
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-us/dnaspp/html/databoundtemplatedcontro
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/library/system.web.ui.webcontrols.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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.