CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > microsoft_downloads.css_friendly_control_adapters Tags:
Item Type: Date Entered: 10/7/2006 1:41:16 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 1 Views: 57 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
"Dman100" <>
NewsGroup User
MenuAdapter - modify BuildItem method10/7/2006 1:41:16 AM

0

I've been messing around for a couple of hours trying to add the following two statements to the BuildItem method in the MenuAdapter class file:

 if (item.Value != null && item.Value.Length > 0)
                    writer.WriteAttribute("id", item.Value);

if (item != Control.SelectedItem)
    writer.WriteAttribute("class", "AspNet-Menu-Link");
else
    writer.WriteAttribute("class", "AspNet-Menu-Link-Selected");

This does add the id and class, but it is displaying on my page rather than emitting the id and class in the html?

What am I doing incorrectly?

Here is the modified method I was trying:

private void BuildItem(MenuItem item, HtmlTextWriter writer)
{
Menu menu = Control as Menu;
if ((menu != null) && (item != null) && (writer != null))
{
writer.WriteLine();
writer.WriteBeginTag(
"li");
writer.WriteAttribute(
"class", item.ChildItems.Count > 0 ? "AspNet-Menu-WithChildren" : "AspNet-Menu-Leaf");
writer.Write(
HtmlTextWriter.TagRightChar);
writer.Indent++;
writer.WriteLine();
if (item.NavigateUrl.Length > 0)
{
writer.WriteBeginTag(
"a");
writer.WriteAttribute(
"href", Page.ResolveUrl(item.NavigateUrl));
writer.WriteAttribute(
"class", "AspNet-Menu-Link");
if (item.Target.Length > 0)
{
writer.WriteAttribute(
"target", item.Target);
}
if (item.ToolTip.Length > 0)
{
writer.WriteAttribute(
"title", item.ToolTip);
}
else if (menu.ToolTip.Length > 0)
{
writer.WriteAttribute(
"title", menu.ToolTip);
}
writer.Write(
HtmlTextWriter.TagRightChar);
writer.Indent++;
writer.WriteLine();
}
else
{
writer.WriteBeginTag(
"span");
writer.WriteAttribute(
"class", "AspNet-Menu-NonLink");
writer.Write(
HtmlTextWriter.TagRightChar);
writer.Indent++;
writer.WriteLine();
}
if (item.ImageUrl.Length > 0)
{
writer.WriteBeginTag(
"img");
writer.WriteAttribute(
"src", Page.ResolveUrl(item.ImageUrl));
writer.WriteAttribute(
"alt", item.ToolTip.Length > 0 ? item.ToolTip : (menu.ToolTip.Length > 0 ? menu.ToolTip : item.Text));
writer.Write(
HtmlTextWriter.SelfClosingTagEnd);
}
writer.Write(item.Text);
if (item.NavigateUrl.Length > 0)
{
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag(
"a");
}
else
{
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag(
"span");
}
if ((item.ChildItems != null) && (item.ChildItems.Count > 0))
{
BuildItems(item.ChildItems,
false, writer);
}
if (item.Value != null && item.Value.Length > 0)
writer.WriteAttribute(
"id", item.Value);
if (item != Control.SelectedItem)
writer.WriteAttribute(
"class", "AspNet-Menu-Link");
else
writer.WriteAttribute("class", "AspNet-Menu-Link-Selected");

writer.Indent--;
writer.WriteLine();
writer.WriteEndTag("li");
}
}

 

"Dman100" <>
NewsGroup User
Re: MenuAdapter - modify BuildItem method10/8/2006 5:07:08 PM

0

It took a couple of days, but I finally got this figured out.

Thanks.

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


Free Download:













using fonts ???

deleting a folder with directory.delete(path,true) throws an error

silverlight

hi give me some idea

send form content via email

to get information from user .....the best way?

resource files problem when using no code-behind

how o edit dropdown list

how to redirect urls by implementing ihttpmodule to url without extension

displaying file in browser

creating a not so random guid

data reader

how do convert to different languages in web application?

the best possible way to encrypting connection-string

database

best place to store connection string

how do i submit a form?

how to pass values using cookies?

execute "out of process" process

asp.net topic on web pages

looking for asp simple system

how to convert jpg to eps?

timer problem

two link controls

images and drawing

timestamping each record

anything wrong with using static functions?

calling gc.gettotalmemory in a web app

hi

input string not in correct format?!

very strange postback and viewstate conflict problem

need help to read icalendar info from mail server

webfarm server.transfer context.items

content disappears after button press?

c# or vb??

images - sizing

renaming a class

saving search results to database and retrieving - resume session

findcontrol within gridview

what is the best .net pdf library to use?

how to format a date??

getapplicationpath and menu items

resource not found after compiling!

setting links to read from the url

aspnetdb automaticly creates itself

i cannot read any .asp pages

could not load file ...

replacing objectlist with text boxes when using database

prototype.js example... anyone?

one click to put all gridview cells in edit mode

   
  Privacy | Contact Us
All Times Are GMT