CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 10/24/2007 6:35:30 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 15 Views: 40 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
16 Items, 1 Pages 1 |< << Go >> >|
that guy
Asp.Net User
Custom attribute to sitemap datasource10/24/2007 6:35:30 PM

0/0

 Using the 2.0 framework, I would like to be able to add the custom attributes of target and accesskey to sitemap data sources and have them be members of the  System.Web.UI.WebControls.MenuItem.

Any help would be appreciated.  Thanks. 

Adam.Kahtava
Asp.Net User
Re: Custom attribute to sitemap datasource10/24/2007 7:17:52 PM

0/0

Take a look at the ASP.NET 2.0 CSS Friendly Control Adapters 1.0, they provide the source code for an override of the standard ASP.NET menu. I'm sure you could modify this source to add an access key or target attribute.


-Adam Kahtava [http://adam.kahtava.com]
that guy
Asp.Net User
Re: Custom attribute to sitemap datasource10/24/2007 8:20:39 PM

0/0

 Adam--

Thank you very much for a quick reply.

I am currently using the CSS Friendly Control Adapters and have attempted modifications to the MenuAdapter.vb file in an attempt to add specific attributes from the sitemap data source files. 

When the MenuAdapter.vb code is modified to:

If (Not String.IsNullOrEmpty(menu.TabIndex)) Then
writer.WriteAttribute("tabindex", menu.TabIndex)
End If  

The tabindex value is applied from the page code of:

<asp:menu id="GeneralMenu" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" CssClass="menu-main" MaximumDynamicDisplayLevels="0" TabIndex="6100" />

The same tabindex value is applied through all child nodes of the sitemap data source.

When I modify the MenuAdapter.vb code to the following in attempt to pick up the specified tabindex value as coded in the sitemap XML data source: 

If (Not String.IsNullOrEmpty(item.TabIndex)) Then
writer.WriteAttribute("tabindex", item.TabIndex)
ElseIf (Not String.IsNullOrEmpty(menu.TabIndex)) Then
writer.WriteAttribute("tabindex", menu.TabIndex)
End If

A compilation error of "tabindex is not a member of the System.Web.UI.WebControls.MenuItem"

The same circumstances apply to the use of accesskey.

I am at a loss of how to or what needs to be done to resolve this compilation error.

Thank you very much.

Adam.Kahtava
Asp.Net User
Re: Custom attribute to sitemap datasource10/24/2007 10:39:14 PM

0/0

A quick look at the Menu class reveals that the MenuItem is sealed. That's not good! I wonder if we could create our own MenuItem mockup from the Item class or create a Custom Site Map Provider via the ASP.NET Sitemap API to achieve something similar.


-Adam Kahtava [http://adam.kahtava.com]
Adam.Kahtava
Asp.Net User
Re: Custom attribute to sitemap datasource10/24/2007 10:48:29 PM

0/0

An excerpt from a somewhat related post: "the MenuItem class is sealed and cannot be inherited." - CheckBoxes in ASP.Net 2.0 Menu Control


-Adam Kahtava [http://adam.kahtava.com]
that guy
Asp.Net User
Re: Custom attribute to sitemap datasource10/24/2007 11:31:55 PM

0/0

 Thanks, Adam.

I am wondering if the MenuItem class is also sealed within the 3.5 Framework.  What I do know is that without the addition of the menu.TabIndex value to the CSS Friendly Control Adapters, the control adapters do not follow the linear tab order within a Web content page.  Without it, the tab order of the adapters will fall at the bottom of the tab order regardless of the adapter's placement within the Web page's structure. 

It has me totally confused ... what is the point behind the ability to use custom attributes within any sitemap data source. Proper tab order and functional/practical shortcut key assignment are fundamental issues for device independence.

Thanks, again.  It is very much appreciated. 

Adam.Kahtava
Asp.Net User
Re: Custom attribute to sitemap datasource10/25/2007 3:41:40 AM

0/0

Custom attributes in the ASP.NET SiteMap can be pretty useful as it provides an API that keeps track of your position within the SiteMap. However, this sealed MenuItem presents a challenge when trying to add something to MenuItem attributes.

But... We might be able to do it a different way. We might be able to specify the tab order manually in the existing Menu Adapter.

Example:

    In the CSS Friendly Adapter do something like:

    if (IsLink(item))
    {
        writer.WriteBeginTag("a");
        writer.AddAttribute("tabindex", indexValue);
        indexValue++;
        if (!String.IsNullOrEmpty(item.NavigateUrl))

 

Or modify the control structure in the ASP.NET PreRender Event before it's rendered to the browser.


-Adam Kahtava [http://adam.kahtava.com]
that guy
Asp.Net User
Re: Custom attribute to sitemap datasource10/25/2007 2:17:41 PM

0/0

 Adam, thank you very much for your suggestions.

However, how they can be implemented, I am at a loss.  Assumption is made that the indexValue needs to be declared. My assumption could very well be wrong -- I am neither a designer nor a developer -- just a guy who is trying to get a control to meet the most fundamental of HTML basics, i.e, proper tab order and shortcut key navigation. 

A bit of editorial advise to Microsoft:  get the basics met before implementation of the circus acts within your product offerings.

Thank you very much. 

 

Adam.Kahtava
Asp.Net User
Re: Custom attribute to sitemap datasource10/25/2007 5:49:09 PM

0/0

The tab order, shortcut key navigation, and other accessibility issues are becoming more of a concern as the web matures, but they haven't necessarily been a fundamental of HTML basics. Keep in mind that ASP.NET was first released in 2002 (back when table based design and blinking text were the norm), but today it's a new world with new requirements.

I'm sure others would appreciate your suggested features, you may want to make a request, or leave a forum post on the CSS Friendly Control Adapters Forum.


-Adam Kahtava [http://adam.kahtava.com]
that guy
Asp.Net User
Re: Custom attribute to sitemap datasource10/25/2007 7:55:16 PM

0/0

 ASP.NET was released in 2002 with the first release of HTML 4.0 and the WCAG in 1997 and 1999, respectively.  NET Framework is one hell of a framework that allows the developer to customize a great many things but this is not a discussion of URI re-mapping.  Microsoft likes to promote the flexibility of custom attributes within sitemap data sources but continues to lock up the Menu and MenuItem in the 3.5 framework with full knowledge that tabindex and accesskey implementation was a feature request prior to 2.0 and one that has still not met the feature cut.

It is not the burden of any independent developer to rewrite nor build a fundamental control, even if using Mitchell's skmenu control, so the developer can use a recognized and fundamental attribute that predates the entire ASP.NET platform.

As of yet, no Microsoft engineer has stepped up to the plate to accommodate such a fundamental. Five years is long enough.

PS -- The developers of the CSS Friendly Control Adapters, along with Microsoft, have known, since Beta 3, of the tab order issue of the tab order falling to the very bottom regardless of the adapter's logical order within the content page.  That issue is easily resolved by using the code presented within the second post of this thread.

Adam, I am not railing against you nor your advice.  It is Microsoft who, again, has earned my disgust.

Thank you very much. 

Adam.Kahtava
Asp.Net User
Re: Custom attribute to sitemap datasource10/25/2007 8:35:16 PM

0/0

As Fred Brooks once said: "The tar pit of software engineering will continue to be sticky for a long time to come."

No offenses taken, best of luck with your programming endeavors.


-Adam Kahtava [http://adam.kahtava.com]
Amanda Wang - M
Asp.Net User
Re: Custom attribute to sitemap datasource10/26/2007 7:34:02 AM

0/0

Hi,

Base on your description, you set the a custom attribute of target for the sitemap node, and want to make the menuitem can access this custome attribute, right?

You can not use the menuitem to access the custom attribute directory, you should use the sitemapnode, try to do like below:

 protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
    {
        SiteMapNode nodeFromSiteMap = (SiteMapNode)e.Item.DataItem;
        if (nodeFromSiteMap.Title == "Home")
        {
            Response.Write(nodeFromSiteMap["Target"]);
        }
    }

If you want to set the menuitem's target, you also can use the menu's dynamicatemplate, put a hyperlink contro in it, set the hyperlink's target, like below:

<asp:Menu ID="Menu1" runat="server" OnDataBound="Menu1_DataBound"
            OnMenuItemDataBound="Menu1_MenuItemDataBound" DataSourceID="SiteMapDataSource1">
            <DynamicItemTemplate>
                      <asp:HyperLink ID="l1" runat="server" Text='<%# Eval("Text") %>' NavigateUrl='<%# Eval("NavigateUrl") %>' Target="blank" BackColor="Yellow" Font-Underline="false" /> 
                              </DynamicItemTemplate>
                   </asp:Menu>

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
Adam.Kahtava
Asp.Net User
Re: Custom attribute to sitemap datasource10/26/2007 3:01:48 PM

0/0

@Amanda,

We were looking at options for adding the TabIndex and AccessKey attribute to the ASP.NET Menu.
 


-Adam Kahtava [http://adam.kahtava.com]
that guy
Asp.Net User
Re: Custom attribute to sitemap datasource10/26/2007 3:32:06 PM

0/0

Good morning, Amanda.

Thank you very much for your response.

No, ma'am, I do not need to create a custom attribute of target for the sitemap data source. Target is already a recognized member of the MenuItem class.

Let me back up a little.  Please bear with me.

My technical objective of the NET Platform is to produce standards compliant CSS based Web communication. The code must meet the XHTML 1.1 standard, drop back to a XHTML 1.0 standard when incorporating certain multi-media formats and meet the WCAG Priority 2, preferably Priority 3, accessibility guidelines. It should do this with the most direct methods and only use the barest minimum JavaScript to improve useability as needed.

With use of a few additions such as a modifed XHMTL 1.1 DTD that incorporates the W3C XHMTL 1.1 Target Module and and a XHTML 1.0 modified DTD that includes the target attribute and embed object, along with the CSS Friendly Control Adapters, NET 2.0 and NET 3.5, out of the box, will almost achieve that objective.

One small critical hurdle remains. The attributes of tabindex and accesskey must be recognized as members of the MenuItem class.

Setting a tabindex value is critical within the CSS Friendly Control Adapters as previoulsy mentioned within prior posts. There are problems, again as previously mentioned, that, without tabindex being a member of the MenuItem class, tab values are assigned in block to the specified block of menu items within the code.  This does not present a useability problem.  The critical issue is that a tab value is assigned to the menu block so that its tab order is established within the linear order of the Web page's content.

The ability to assign accesskey values is both fundamental and critical. Granted, shortcut key assignment and use are problematic but a well thought out use of a modified United Kingdom Standard does have merit. Any problematic implementation of shortcut keys should not preclude the ability for their use at the designer's/developer's discretion.

[A developer can overcome these shortcut key assignment issues within NET by using an HTML definition list to assign accesskey values and then use CSS to drop the code into a one pixel off screen blackhole.]

Addition of custom attributes to the sitemap data source and have them be recognized members of the MenuItem class is a direct route except the MenuItem class is sealed.  The obvious solution is that Microsoft, internally, add the tabindex and accesskey attributes as direct members of the MenuItem class.

What do I need to do to help Microsoft achieve and implement addition of highly used and fundamental attributes to the MenuItem class?

Additions of the use of the acronym and abbr elements within specific MenuItem attributes also has merit. But I am already pushing the envelope I am afraid with the request for tabindex and accesskey.

If needed, the methods that I have used to partially overcome these obstacles have been integrated into my testing Web site of:  http://boinkinchipmunks.com.  Please be aware that the content has been rated with the ICRA as Mature and that my sense of humor is somewhat different. Overlook them if necessary.

Any questions, please advise.

Again, thank you very much.

Amanda Wang - M
Asp.Net User
Re: Custom attribute to sitemap datasource10/29/2007 9:06:12 AM

0/0

Hi,

I'm sorry for misunstanding you in my last post.

Form your description, you want to add two custom property tabindex and acceccKey for the sitemap datasource, right?

In fact, you can add the custom attribut for the sitemap node, for example:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
  <siteMapNode url="http://www.yahoo.com" title="Home"  description="" Tareget="_Blank" tabindex="1" AccessKey="A">
    <siteMapNode url="" title="Links"  description="" Tareget="_Blank" tabindex="2" AccessKey="B">
      <siteMapNode url="" title="xzy.com"  description="" Tareget="_Blank" tabindex="3" AccessKey="C" />
    </siteMapNode>
    <siteMapNode url="" title="Account"  description="" Tareget="_Blank" tabindex="4" AccessKey="D">
      <siteMapNode url="~/dates.aspx" title="Dates"  description="" Tareget="_Blank" tabindex="5" AccessKey="E"/>
    </siteMapNode>
  </siteMapNode>
</siteMap>

And you can access the custom attribute like below:

 protected void Menu_Top_MenuItemDataBound(object sender, MenuEventArgs e)
    {
        SiteMapNode smp = (SiteMapNode)e.Item.DataItem;
        e.Item.Text = " <div  tabindex=" + smp["tabindex"].ToString() + " AcceccKey=" + smp["AccessKey"].ToString() + ">" + e.Item.Text + " </div>"        
    }

From the above code, we can get the custom attributs, but they are cannot be apply for the menuItems.

In deed, the menu control has the TabIndex and AccessKey property,  However they are inherited by the base WebControl and it is not taken into account anywhere else.

Thanks for your valuable feedback you may also submit it to the fillowing site in the formal way,  http://connect.microsoft.com/visualstudio  

This is something will be considered for future versions.

hope it helps. 

 


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
that guy
Asp.Net User
Re: Custom attribute to sitemap datasource10/30/2007 7:31:51 PM

0/0

Thank you very much, Amanda.  Misunderstandings are allowed and never feel a need to make an apology to me, please.

I am still at a loss on how to add any custom attribute from a sitemap datasource for the NET menu control.

I will refer to a post made by Danny Chen in March 2005 located at http://weblogs.asp.net/dannychen/archive/2005/03/28/396099.aspx and titled, "Binding to custom web.sitemap attributes".

Quote by Chen [exception taken to his assumption of "wasn't really useful data about a Site Map node"]:

"We've had various feature requests come in for the site navigation feature to include additional built in properties.  This got turned down because it wasn't really useful data about a Site Map Node and because it was easily done through the extensibility features.  In general this will work for any custom attribute but I'll show examples for target since it's the most commonly requested."

Having applied Chen's recommendations to bind custom sitemap attributes the following code exists:

Sitemap XML Data

1    
2    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
3      <siteMapNode>
4      	<siteMapNode url="~/default.aspx" title="Home" description="Home Page" 
5    	tabindex="6101" accesskey="1"/>
6    	<siteMapNode url="~/web/contact/contact.aspx" title="Contact" description="Contact Information" 
7    	tabindex="6102" accesskey="9"/>
8      	<siteMapNode url="~/web/policy/privacy.aspx" title="Privacy" description="Privacy Policy" 
9    	tabindex="6103" accesskey="7"/>
10   	<siteMapNode url="~/web/policy/safety.aspx" title="Safety [ND]" description="Safety Policy" 
11   	tabindex="6104" accesskey="6"/>
12   	<siteMapNode url="~/web/policy/copyright.aspx" title="Copyright" description="Copyright Notice" 
13   	tabindex="6105" accesskey="5"/>
14   	<siteMapNode url="~/web/accessibility/general.aspx" title="Accessibility"
15   	description="About the Web Site and Accessibility" 
16   	tabindex="6106" accesskey="4"/>
17   	<siteMapNode url="~/web/accessibility/keyboard.aspx" title="Shortcuts" 
18   	description="Keyboard Shortcut Links. Opens in a New Window." target="_blank"
19   	imageurl="~/App_Themes/images/window_arrow.gif" 
20   	tabindex="6107" accesskey="0"/>
21   	<siteMapNode url="~/web/sitemap/site.aspx" title="Site Map" description="Site Map" 
22   	tabindex="6108" accesskey="3"/>
23     </siteMapNode>
24   </siteMap>

 

The pertinent content page menu control code [Note: AutoAccesskey="false" is present to turn off the accesskey function within the CSS Friendly Control Adapters.]

<asp:sitemapdatasource id="SiteMapDataSource1" runat="server" ShowStartingNode="false"
sitemapprovider="SiteMapProvider1" />

<asp:menu id="GeneralMenu" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
CssClass="menu-main" MaximumDynamicDisplayLevels="0" AutoAccessKey="false"
OnMenuItemDataBound="GeneralMenu_MenuItemDataBound" />

 

The code behind - VB script:

1    Partial Class Main
2     	Inherits System.Web.UI.MasterPage
3    
4    	Protected Sub GeneralMenu_MenuItemDataBound(ByVal sender As Object, _
5          	ByVal e As MenuEventArgs) _
6          	Handles GeneralMenu.MenuItemDataBound
7    
8    	  	e.Item.imageurl = CType(e.Item.DataItem, SiteMapNode)("imageurl")
9    		e.Item.target = CType(e.Item.DataItem, SiteMapNode)("target")
10   
11       	End Sub
12   
13       	Protected Sub PrimaryMenu_MenuItemDataBound(ByVal sender As Object, _
14         	ByVal e As MenuEventArgs) _
15        	Handles PrimaryMenu.MenuItemDataBound
16   
17   	  	e.Item.imageurl = CType(e.Item.DataItem, SiteMapNode)("imageurl")
18   		e.Item.target = CType(e.Item.DataItem, SiteMapNode)("target")
19   
20       	End Sub
21   
22   
23   End Class

 

According to Chen's logic by adding the code:

e.Item.tabindex = CType(e.Item.DataItem, SiteMapNode)("tabindex")
e.Item.accesskey = CType(e.Item.DataItem, SiteMapNode)("accesskey")

data binding should occur from the sitemap datasource for the above custom attributes.

When implemented, compilation errors occur that these two custom attributes are not recognized members of the MenuItem class.

Please, what code behind do I need to explicity add so that these custom attributes are recognized.

Forgive and overlook my ignorance.

Thank you very much.

16 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional ASP.NET 2.0 Databases Authors: Thiru Thangarathinam, Pages: 504, Published: 2007
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007
Pro C# 2008 and the .NET 3.5 Platform Authors: Andrew Troelsen, Pages: 1370, Published: 2007
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Pro VB 2008 and the .NET 3.5 Platform Authors: Andrew Troelsen, Pages: 1377, Published: 2008
Professional C# 2005 with .NET 3.0 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Pages: 1748, Published: 2007
Professional C# 2008 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Pages: 1782, Published: 2008
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Professional C# 2005 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Allen Jones, Pages: 1540, Published: 2006

Web:
Custom attribute to sitemap datasource - ASP.NET Forums It has me totally confused ... what is the point behind the ability to use custom attributes within any sitemap data source. ...
Custom attribute to sitemap datasource - ASP.NET Forums Re: Custom attribute to sitemap datasource ... I am still at a loss on how to add any custom attribute from a sitemap datasource for the NET ...
Adding Custom Attributes to ASP.NET Site Map Files to Improve ... We can bind this to a Repeater control using a SiteMapDataSource control to generate a list of links ... Custom attributes are accessed via an indexer e.g. ...
SiteMapDataSource When data-bound to a SiteMapDataSource control, Telerik RadMenu automatically ... 'Access custom attributes: Dim node1 As SiteMapNode = DirectCast(e.Item. ...
O'Reilly - Safari Books Online - 9780768680256 - ASP.NET 3.5 Unleashed First, you learn how to use the SiteMapDataSource control to represent a Site Map on ... You also learn how you can extend Site Maps with custom attributes. ...
Using the SiteMapDataSource to display lists of links - ShowUsYour ... ... showed off by adding a custom attribute to my SiteMapNode's like so: ...
DotNetSlackers: Binding to custom web.sitemap attributes Web.sitemap allows for custom attributes to be added to each SiteMapNode. ... Now add a menu or treeview to the page bound to the SiteMapDataSource. ...
ASP.NET.4GuysFromRolla.com: Examining ASP.NET 2.0's Site ... Mar 8, 2006 ... Adding Custom Attributes to the Site Map's Nodes .... The SiteMapDataSource is a control that returns the site map data to the TreeView or ...
Custom Site Map Providers in ASP.NET 2.0 NET 2.0 is a set of controls that attach to their datasource using a provider ..... Any custom XML attributes you have defined within the provider ...
Nine ASP.NET Site Navigation Problem Solutions: Part 1 The SiteMapDataSource control provides easy programmatic access to the .... it is to extend the approach using SiteMapPath templates and custom attributes. ...




Search This Site:










3.0.7 issue - works only with case insensitive db setup

unable to reach the menuitemclick event handler

login problem - dnn 2.04 css skins.

the name xxx does not exist in the current context

dotnetnuke development setup

photos classified starter kit?

password requirement modification

csk with sql express and paypal aspnet user login fail

anybody ever seen this error and know how to resolve?

can access parametrized data from query builder, but not from sqldatasource

what happened to "disable version in page title"?

scraped php and master page that displays improperly

error when uploading file to sub sub directory using file manager

treeview (401) unauthorized

recover username?

large project with multiple subweb projects

using multiple master pages?

how to show code in a blog post?

error logging in after upgrading to 1.0.10c

solpart menu functionality limits?

privacy statement navigation

better app that provides user-configurable table ?

built-in controls with custom providers

heme 'xxx' cannot be found in the application or global theme directories. iis

web service using managed and unmanaged code returns 401.

not automatically collapse thread in discussion module

content sub folders - performance issue for portlets that access files

a footer of masterpage comes overlapped to the contents of sub page.

3.05 password not specified in notification mail to superuser

how to install this?forumblog_03[2].00.00.zip

 
All Times Are GMT