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. Unable to hide the Label Column

Unable to hide the Label Column

Scheduled Pinned Locked Moved ASP.NET
question
7 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.
  • J Offline
    J Offline
    johnmuthu
    wrote on last edited by
    #1

    I am using a gridview where I have a lable bound column to keep unique ids. During DataRowBound event i hide the label column. int labelColumn = 0; e.Row.Cells[labelColumn].Visible = false; I keep the above code snippet in DataRowBound of GridView1. When try to use the label column value at client side, I am Unable to access the value. If i don't hide the column I am able to access label value. Now i want to hide the label Column. How could i do? I even tried by making the lable column width as 0px. Thanks in advance. :)

    Muthu.G

    A P 2 Replies Last reply
    0
    • J johnmuthu

      I am using a gridview where I have a lable bound column to keep unique ids. During DataRowBound event i hide the label column. int labelColumn = 0; e.Row.Cells[labelColumn].Visible = false; I keep the above code snippet in DataRowBound of GridView1. When try to use the label column value at client side, I am Unable to access the value. If i don't hide the column I am able to access label value. Now i want to hide the label Column. How could i do? I even tried by making the lable column width as 0px. Thanks in advance. :)

      Muthu.G

      A Offline
      A Offline
      Ashish Sehajpal
      wrote on last edited by
      #2

      pretty simple solution dear use direct <%# Eval("columnname") % > as argument in javascript function or wherever you need to call the value of that label..... do not use any label or column in specific cheers !

      Ashish Sehajpal

      J 1 Reply Last reply
      0
      • J johnmuthu

        I am using a gridview where I have a lable bound column to keep unique ids. During DataRowBound event i hide the label column. int labelColumn = 0; e.Row.Cells[labelColumn].Visible = false; I keep the above code snippet in DataRowBound of GridView1. When try to use the label column value at client side, I am Unable to access the value. If i don't hide the column I am able to access label value. Now i want to hide the label Column. How could i do? I even tried by making the lable column width as 0px. Thanks in advance. :)

        Muthu.G

        P Offline
        P Offline
        P S Pundeer
        wrote on last edited by
        #3

        You can use hidden field html server control instead of label.

        puranonnet@hotmail.com www.ibrinte.com

        J 1 Reply Last reply
        0
        • P P S Pundeer

          You can use hidden field html server control instead of label.

          puranonnet@hotmail.com www.ibrinte.com

          J Offline
          J Offline
          johnmuthu
          wrote on last edited by
          #4

          Thanks a lot, that works fine. :-D

          Muthu.G

          1 Reply Last reply
          0
          • A Ashish Sehajpal

            pretty simple solution dear use direct <%# Eval("columnname") % > as argument in javascript function or wherever you need to call the value of that label..... do not use any label or column in specific cheers !

            Ashish Sehajpal

            J Offline
            J Offline
            johnmuthu
            wrote on last edited by
            #5

            Thanks for the reply dear. i thing u mean to say, in DataBinding of label (that's in design mode), for label just use Eval("columnname"). But will that solve the problem of hiding the label field at run time? Plz be brief in ur ans. Also how to use it as an arg of js function?

            Muthu.G

            A 1 Reply Last reply
            0
            • J johnmuthu

              Thanks for the reply dear. i thing u mean to say, in DataBinding of label (that's in design mode), for label just use Eval("columnname"). But will that solve the problem of hiding the label field at run time? Plz be brief in ur ans. Also how to use it as an arg of js function?

              Muthu.G

              A Offline
              A Offline
              Ashish Sehajpal
              wrote on last edited by
              #6

              using an HTML control is not the solution as per architecture...if there are 1000 records, there will be 1000 html control and every time you will be finding that control via javascript.... passing argument to javascript is very easy onclick='functionname(<%# Eval("arg1")%>,<%# Eval("arg2")%> ) ;' you can use any event i.e. onchange , onblur , ondoubleclick etc..... it will outperform in terms of performance

              Ashish Sehajpal

              J 1 Reply Last reply
              0
              • A Ashish Sehajpal

                using an HTML control is not the solution as per architecture...if there are 1000 records, there will be 1000 html control and every time you will be finding that control via javascript.... passing argument to javascript is very easy onclick='functionname(<%# Eval("arg1")%>,<%# Eval("arg2")%> ) ;' you can use any event i.e. onchange , onblur , ondoubleclick etc..... it will outperform in terms of performance

                Ashish Sehajpal

                J Offline
                J Offline
                johnmuthu
                wrote on last edited by
                #7

                Thanks Ashish. got it...

                Muthu.G

                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