Unable to hide the Label Column
-
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
-
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
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
-
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
You can use hidden field html server control instead of label.
-
You can use hidden field html server control instead of label.
-
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
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
-
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
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
-
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