Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 10th, 2008, 04:13 AM
Authorized User
 
Join Date: Mar 2007
Location: , , Denmark.
Posts: 52
Thanks: 6
Thanked 2 Times in 2 Posts
Default The html rendered by controls...

This is a little off-topic, hope its ok…

How do you guys deal with the html rendered by the different controls e.g. Login, Menu, CreateUserWizard etc.? Do you use them as is, and live with the tables? Do you use CSS adapters, or maybe something else?
I mean, the rendered code is not standards compliant, and I really don't like tables in my layout as I feel they should only be used to display data.
I tried playing with the CSS adapters, and I find them totally confusing and not easy to use for people with less experience like me. Also, it seems like this project has more or less died, and the documentation is really not great.
I wish Microsoft had thought of this when they released .NET 3.5.

Any thoughts?
  #2 (permalink)  
Old October 10th, 2008, 09:01 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

I couldn't agree more with your last statement; Microsoft should have released a set of companion controls to these that work on the same principle as the ListView, with design-time flexibility over all the UI rendering.

For the login controls, if you use templates for everything, INCLUDING the button navigation, you can actually get rid of all the internal structure of the enclosing table -- that is, you can eliminate the rows and cells -- and are then left with just the enclosing table, which is about the best you can do without going to the CSS adapters. I find that for most projects, that's good enough for me.

The CSS adapters are not horrible, but keep in mind that they simply don't work when templates are applied. Of course, that kinda makes sense -- since they give you total flexibility in styling, there should be no need to use templates with them in the first place. I agree that they are confusing unless you are really good with CSS. I've had pretty good luck working with the treeview CSS control in that way.

Of course, the other alternative is to give up the controls altogether and work with the methods in the Membership, MembershipUser, FormsAuthentication, etc, directly for the Login controls.

I never use the Menu control -- it just plain sucks. For those, if you really need something fancy, you might consider going with a third-party menu like the Telerik one, which is excellent if a bit pricey.

  #3 (permalink)  
Old October 10th, 2008, 12:59 PM
Authorized User
 
Join Date: Mar 2007
Location: , , Denmark.
Posts: 52
Thanks: 6
Thanked 2 Times in 2 Posts
Default

Quote:
quote:Originally posted by Lee Dumond
 I couldn't agree more with your last statement; Microsoft should have released a set of companion controls to these that work on the same principle as the ListView, with design-time flexibility over all the UI rendering.
Yes, the ListView is a step in the right direction. Would be great if all the other controls were as flexible.

I really want to get my hands dirty with alle the backend stuff, but I usually only get to the UI. Then I get so annoyed with the html rendered by the controls, and I end up spending all my time figuring out how to change it... This is just something I can't ignore. That's why I wondered what all you more professional guys do

Quote:
quote:Originally posted by Lee Dumond

For the login controls, if you use templates for everything, INCLUDING the button navigation, you can actually get rid of all the internal structure of the enclosing table -- that is, you can eliminate the rows and cells -- and are then left with just the enclosing table, which is about the best you can do without going to the CSS adapters. I find that for most projects, that's good enough for me.
Well, I managed to use a Login Control as a template, and wrote it out as an unordered list. That worked pretty well, except that the content placeholder wrapped the whole thing in a table…

I wasn’t as successful with the Menu Control though. Seems a little more complicated to use as a template. I’ll have to look into that.

Quote:
quote:Originally posted by Lee Dumond

Of course, the other alternative is to give up the controls altogether and work with the methods in the Membership, MembershipUser, FormsAuthentication, etc, directly for the Login controls.

I never use the Menu control -- it just plain sucks. For those, if you really need something fancy, you might consider going with a third-party menu like the Telerik one, which is excellent if a bit pricey.
Say I want to create a menu. I can just write one as an UL, style it up with CSS and still use it with a SiteMapDataSource? I can’t really find any good tutorials/articles on this…
Those Telerik controls are way out of my pricerange…


  #4 (permalink)  
Old October 10th, 2008, 01:57 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Quote:
quote:Originally posted by philthy


Say I want to create a menu. I can just write one as an UL, style it up with CSS and still use it with a SiteMapDataSource? I can’t really find any good tutorials/articles on this…
Those Telerik controls are way out of my pricerange…
Of course. You can use the SiteMapDataSource as a DataSource for the BulletedList control. On the BulletedList control, set the DisplayMode to "HyperLink", set the DataSourceID to the ID of the SiteMapDataSource; set the DataTextField to "title", and set the DataValueField to "url".

This will render as a[list] list of links in the browser, which you can style to your heart's content. If you need pull-down menus, you'll have to write the JavaScript for it too.

  #5 (permalink)  
Old October 23rd, 2008, 02:49 PM
Authorized User
 
Join Date: Mar 2007
Location: , , Denmark.
Posts: 52
Thanks: 6
Thanked 2 Times in 2 Posts
Default

I used the ListView to generate a menu from the siteMap, like this:

Code:
<asp:ListView ID="ListView1" runat="server" DataSourceID="SiteMapDataSource1">
                <LayoutTemplate>
                    <ul class="menu">
                        <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
                    </ul>
                </LayoutTemplate>
                <ItemTemplate>
                    <li>
                    <a href='<%#Eval("url") %>'><%#Eval("title") %></a>
                    </li>
                </ItemTemplate>
            </asp:ListView>
        <asp:SiteMapDataSource ID="SiteMapDataSource1" ShowStartingNode="false" runat="server" />
Then in my CSS, I made a class...
Code:
.menu li
{
    display:inline;
    float:left;
}
This generates a nice clean horizontal ul/li menu like this...

Code:
                 <div id="HeaderMenu">
                    <ul class="menu">

                    <li>
                    <a href="/Default.aspx">Start</a>
                    </li>

                    <li>
                    <a href="/Search.aspx">Search</a>
                    </li>

                    <li>
                    <a href="/Contact.aspx">Contact</a>
                    </li>

                    </ul>       
                 </div>
  #6 (permalink)  
Old October 23rd, 2008, 04:23 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Why not just do this?

<asp:BulletedList ID="menu" runat="server" DataSourceID="SiteMapDataSource1"
   DataTextField="Title" DataValueField="Url" DisplayMode="HyperLink">
</asp:BulletedList>

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />


#menu li
{
   list-style: none;
   float: left;
}


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining Controls and HTML AGS BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 1 January 15th, 2006 06:19 PM
HTML controls g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 7 January 10th, 2006 02:14 AM
Referencing Html Controls ~Bean~ ASP.NET 1.0 and 1.1 Basics 3 September 30th, 2005 09:11 AM
HTML Controls rajanikrishna General .NET 1 November 10th, 2004 11:35 AM



All times are GMT -4. The time now is 12:47 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.