DOM ID Property

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • max ternoff
    New Member
    • Apr 2012
    • 4

    DOM ID Property

    Hi there! Can I define manually server control DOM ID property? I want to get the following HTML:

    Code:
     <input name="name" type="text" value="..." id="news_title" />
    instead


    Code:
    <input name="name" type="text" value="..." id="ctl00_ContentPlaceHolder1_formview_NewsFull_newstitl" />
    Last edited by Frinavale; Apr 2 '12, 03:02 PM. Reason: Added code tags
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    The IDs generated for ASP.NET controls are accessible in your server side code by using the ClientID Property.

    So, if you are dynamically generating JavaScript, you can write the ClientID into the script or elsewhere in the HTML using the asp shorthand for response.write: <%=Control.Clie ntID %>. Or you could insert the IDs into an Array server side by using the ScriptManager's or the ClientScriptMan ager's RegisterArrayDe claration method.

    I'm not sure what you're trying to accomplish so I can't give you much more to go on.

    -Frinny
    Last edited by Frinavale; Apr 2 '12, 07:55 PM.

    Comment

    • max ternoff
      New Member
      • Apr 2012
      • 4

      #3
      Frinavale, thank you!

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        No problem.
        If you have any other questions regarding this, you know where to ask.

        Comment

        Working...