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. Get original class name of default_aspx_modules_admin_useredit like name

Get original class name of default_aspx_modules_admin_useredit like name

Scheduled Pinned Locked Moved Web Development
xmlquestion
5 Posts 3 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.
  • F Offline
    F Offline
    FerencTheFifth
    wrote on last edited by
    #1

    Hi, If I do "this.GetType()" in an ascx.cs usercontrol, I get a strange name, which is the auto generated final class, in Web Site Project. e.g. default_aspx_modules_admin_useredit Is there a way to get the real class name, as I wrote the class? public class UserEdit I have some data assigned to controls in XML files, and controls would need to know their own name to access their own data. If possible, I don't want to create a readonly variable with the class name. protected readonly string OwnName = "UserEdit"; :-) Parse from AppVirtualPath? Any better ideas? Many thanks, Ferenc

    N L 2 Replies Last reply
    0
    • F FerencTheFifth

      Hi, If I do "this.GetType()" in an ascx.cs usercontrol, I get a strange name, which is the auto generated final class, in Web Site Project. e.g. default_aspx_modules_admin_useredit Is there a way to get the real class name, as I wrote the class? public class UserEdit I have some data assigned to controls in XML files, and controls would need to know their own name to access their own data. If possible, I don't want to create a readonly variable with the class name. protected readonly string OwnName = "UserEdit"; :-) Parse from AppVirtualPath? Any better ideas? Many thanks, Ferenc

      N Offline
      N Offline
      newc1
      wrote on last edited by
      #2

      Hi, Use this.GetType().BaseType.Name to get the class name or this.GetType().BaseType.FullName for the namespace heierarchy + class name.

      Clean code is the key to happiness.

      F 1 Reply Last reply
      0
      • F FerencTheFifth

        Hi, If I do "this.GetType()" in an ascx.cs usercontrol, I get a strange name, which is the auto generated final class, in Web Site Project. e.g. default_aspx_modules_admin_useredit Is there a way to get the real class name, as I wrote the class? public class UserEdit I have some data assigned to controls in XML files, and controls would need to know their own name to access their own data. If possible, I don't want to create a readonly variable with the class name. protected readonly string OwnName = "UserEdit"; :-) Parse from AppVirtualPath? Any better ideas? Many thanks, Ferenc

        L Offline
        L Offline
        LongRange Shooter
        wrote on last edited by
        #3

        Have you tried getting the type of the type? eg.:

         Type parentClass = this.GetType().GetType();
        
        F 1 Reply Last reply
        0
        • N newc1

          Hi, Use this.GetType().BaseType.Name to get the class name or this.GetType().BaseType.FullName for the namespace heierarchy + class name.

          Clean code is the key to happiness.

          F Offline
          F Offline
          FerencTheFifth
          wrote on last edited by
          #4

          Thank you, this one works well!

          1 Reply Last reply
          0
          • L LongRange Shooter

            Have you tried getting the type of the type? eg.:

             Type parentClass = this.GetType().GetType();
            
            F Offline
            F Offline
            FerencTheFifth
            wrote on last edited by
            #5

            Hi, yes, thanks for comment. That returned "System.RuntimeType" Type in my ascx.cs class.

            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