Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. MasterPages in .NET 2.0 and control naming

MasterPages in .NET 2.0 and control naming

Scheduled Pinned Locked Moved ASP.NET
csharphtmlsysadminbeta-testinghelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rouzbeh_d
    wrote on last edited by
    #1

    I've tried out the express version of Visual Web Developer in order to find out a few details on the new MasterPage framework in .NET 2.0. To my surprice, it found a little problem in the naming of servercontrols that I use in my contentpages. For example if I use a WebControls.Button, I declare it in the aspx file as: Now in regular cases, the control would render itself as an tag on the final document, having it's id parameter set to the id of the Button control. But when using the MasterPages all server controls that produce some sort of html-tag that would be interesting to manipulate on client-side gets an addition to their id. Like . And this produces some problem in some cases. I dont know if it's just because of .NET 2.0 being beta right now or if that's the way it should be in order for the framework to route the events to the right place on postbacks. I hope someone here can give me some more insight into this or point me in the right direction on this.

    M 1 Reply Last reply
    0
    • R Rouzbeh_d

      I've tried out the express version of Visual Web Developer in order to find out a few details on the new MasterPage framework in .NET 2.0. To my surprice, it found a little problem in the naming of servercontrols that I use in my contentpages. For example if I use a WebControls.Button, I declare it in the aspx file as: Now in regular cases, the control would render itself as an tag on the final document, having it's id parameter set to the id of the Button control. But when using the MasterPages all server controls that produce some sort of html-tag that would be interesting to manipulate on client-side gets an addition to their id. Like . And this produces some problem in some cases. I dont know if it's just because of .NET 2.0 being beta right now or if that's the way it should be in order for the framework to route the events to the right place on postbacks. I hope someone here can give me some more insight into this or point me in the right direction on this.

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, I guess that you're not familiar with the ASP.NET 1.x, so you have no idea about the control identification. What you see when you view source at the client side is the value of the ClientID property of the control. Each control basically has 3 properties regarding to its ID that you may need to know: ID, UniqueID and ClientID. The ID propety is the programmatic identifier of a control which you can enter in the Properties window, and you use this property to make a reference to the control to access its properties, methods... In reality, you can place a button with the ID btnSubmit on the content page and you can also place another button with the same ID on its master page. It means that you can place the controls with the same ID in different containers, however, every control on a web page must be uniquely identifiable. So the UniqueID property is used to differentiate the controls, it basically includes the identifier of the container, but you will not use this property in code. The ClientID property is automatically generated by the ASP.NET to identify a control at the client side, this property is much the same as the UniqueID with one exception is the delimitor (':' for the UniqueID, '_' for the ClientID). For more information, you can see these properties of the Control class[^] in MSDN, and Web Forms Control Identification[^]

      R 1 Reply Last reply
      0
      • M minhpc_bk

        Hi there, I guess that you're not familiar with the ASP.NET 1.x, so you have no idea about the control identification. What you see when you view source at the client side is the value of the ClientID property of the control. Each control basically has 3 properties regarding to its ID that you may need to know: ID, UniqueID and ClientID. The ID propety is the programmatic identifier of a control which you can enter in the Properties window, and you use this property to make a reference to the control to access its properties, methods... In reality, you can place a button with the ID btnSubmit on the content page and you can also place another button with the same ID on its master page. It means that you can place the controls with the same ID in different containers, however, every control on a web page must be uniquely identifiable. So the UniqueID property is used to differentiate the controls, it basically includes the identifier of the container, but you will not use this property in code. The ClientID property is automatically generated by the ASP.NET to identify a control at the client side, this property is much the same as the UniqueID with one exception is the delimitor (':' for the UniqueID, '_' for the ClientID). For more information, you can see these properties of the Control class[^] in MSDN, and Web Forms Control Identification[^]

        R Offline
        R Offline
        Rouzbeh_d
        wrote on last edited by
        #3

        Hi, Thanx for that information...i've somehow managed to bypass all that is to learn on Control naming. But I see now why these names are generated. :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups