Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8023209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:30:08+00:00 2026-06-04T22:30:08+00:00

I used this article to create an Image helper: http://www.asp.net/mvc/tutorials/older-versions/views/using-the-tagbuilder-class-to-build-html-helpers-cs . It says it

  • 0

I used this article to create an Image helper:
http://www.asp.net/mvc/tutorials/older-versions/views/using-the-tagbuilder-class-to-build-html-helpers-cs. It says it replaces periods, but has no mention of other limitations.

It all works fine unless I try using GUID string as the id.

The Razor code:

@Html.Image(id, ....) //passes a GUID string to helper fine

The ImageHelper is exactly as the webpage describes:

builder.GenerateId(id);
//breakpoint after this shows the builder object 
//does not create an id attribute when id is a GUID string.
//using id.ToString() doesn't work for GUIDs either

Using the GUID string in MergeAttributes works fine:

builder.MergeAttribute("title", id); //the GUID string is img title no problem
builder.MergeAttribute("class", id); //the GUID string is class as expected 

Is there some limitation or workaround when using GUID strings as an ID?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:30:09+00:00Added an answer on June 4, 2026 at 10:30 pm

    IDs must start with a letter, not a number. Often, a GUID will start with a number, hence the problem. TagBuilder.GenerateId calls CreateSanitizedId, which performs this check:

    if (!TagBuilder.Html401IdUtil.IsLetter(c1))
        return (string) null;
    

    Your best bet is to just add a prefix, like “guid” or something to the beginning of the ID.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used this article : http://www.codeproject.com/KB/WPF/InternationalizedWizard.aspx to create a WPF wizard to handle one
I've used the code in this article before to create a custom validator to
I've used the sql from this article https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/datacenter/?p=275 to try and track down the
Having some issues trying to create a fixed header layout for this jsfiddle: http://jsfiddle.net/4xk4D/107/
I am a new in asp.net mvc 2.0, I tried to search about this
I used this MSDN example to construct my console host app: http://msdn.microsoft.com/en-us/library/ms731758.aspx It works
I used this tutorial to create a basic Javascript function for implementing change during
I used this link to create a SHA1 hash for any data using C++.
I used this tutorial to rename a view controller http://iosdeveloperzone.com/2011/05/14/how-to-rename-a-class-using-refactoring-in-xcode-4/ Basically just switch to
I used this article to write my first own Powershell Cmdlet and Snapin. And

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.