Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
| Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 23rd, 2009, 04:21 PM
Authorized User
 
Join Date: Oct 2009
Posts: 17
Thanks: 7
Thanked 1 Time in 1 Post
Default How to Set DataSource in a Skin File

Hi,

If I set an ItemTemplate of a repeater in a skin file, how can I tell it where to display the relevant fields from my data source. If the ItemTemplate were being defined in a content or master page, I could simply use <$ # Eval ("FieldName") $>. But, in a skin file, data binding is not allowed?

This problem also applies to the menu control. When I wanted to define a different CSS style in each of my themes, as soon as I modified the ItemTemplate, it no longer knows where it should display the nodes of my sitemap path.

At the moment I'm looking into the programmatic options, but ideally I don't want to have to give all my controls an ID and set the values they display in code if I can do it in mark up.

Thanks for reading

Nick

  #2 (permalink)  
Old October 28th, 2009, 03:41 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You can only skin properties that have the Themable attribute applied:

http://www.dotnetattributes.com/Syst...eableAttribute
http://msdn.microsoft.com/en-us/libr...Attribute.aspx

This is not the case with the ItemTemplate property: http://msdn.microsoft.com/en-us/libr...mtemplate.aspx

Typically, UI related properties are themable, behavior related properties aren't. You can use Reflector (www.red-gate.com) to look at properties and see if they can be skinned.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parser Error in skin file Rachel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 January 6th, 2009 10:39 PM
meta:resource key in skin file manoj.aggarwal ASP.NET 2.0 Professional 4 August 9th, 2007 08:37 AM
Object datasource VS DataSource SoftMind BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 July 27th, 2006 10:44 PM
how to add xsd file as a DataSource for the report Mojmir Reporting Services 0 March 9th, 2006 05:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.