![]() |
|
|
|||||||
![]() |
ASP Net - Hide a column in asp:GridView |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hi, I want to hide a column in the asp:GridView, say one of the column of
asp:BoundField. But it is not allowed to put <div> inside for setting it display:none. What can I do? Thanks in millions. ghostwolf |
|
|
|
|
#2 |
|
Posts: n/a
|
To hide the third column for example ...
GridView.Columns[2].Visible = false; "ghostwolf" wrote: > Hi, I want to hide a column in the asp:GridView, say one of the column of > asp:BoundField. But it is not allowed to put <div> inside for setting it > display:none. What can I do? Thanks in millions. > > > =?Utf-8?B?Y2xpY2tvbg==?= |
|
|
|
#3 |
|
Posts: n/a
|
"ghostwolf" <> wrote in message
news:... > Hi, I want to hide a column in the asp:GridView, say one of the column of > asp:BoundField. But it is not allowed to put <div> inside for setting it > display:none. What can I do? Thanks in millions. MyGridView.Columns[0].Visible = false; HOWEVER, bear in mind that this isn't actually *hiding* the column per se - it's physically *removing* the column from the HTML being sent down to the client, which may not be what you really want... Mark Rae |
|
|
|
#4 |
|
Posts: n/a
|
thanks, actually I don't really want to invisible it. It is because I want
to put a value for each row but make it hide away. Just like what we did in windows programming for adding a value for each row. If I make the column in asp:GridView invisible, I cannot get the value from that column. "Mark Rae" <> wrote in message news:... > "ghostwolf" <> wrote in message > news:... > >> Hi, I want to hide a column in the asp:GridView, say one of the column of >> asp:BoundField. But it is not allowed to put <div> inside for setting it >> display:none. What can I do? Thanks in millions. > > MyGridView.Columns[0].Visible = false; > > HOWEVER, bear in mind that this isn't actually *hiding* the column per > se - it's physically *removing* the column from the HTML being sent down > to the client, which may not be what you really want... > ghostwolf |
|
|
|
#5 |
|
Posts: n/a
|
"ghostwolf" <> wrote in message
news:O4v$... > thanks, actually I don't really want to invisible it. It is because I want > to put a value for each row but make it hide away. Just like what we did > in windows programming for adding a value for each row. If I make the > column in asp:GridView invisible, I cannot get the value from that column. Ah... You've discovered the additional security feature that a GridView has but a DataGrid didn't. Basically, Microsoft took the view that using hidden columns to store data was a potential security risk, so they removed hidden colums from ViewState at databind time. However, it's easy enough to work round, but be aware of the potential security risk involved in doing this... MyGridView.DataSource = <datasource>; MyGridView.Columns[0].Visible = true; MyGridView.DataBind(); MyGridView.Columns[0].Visible = false; Mark Rae |
|
|
|
#6 |
|
Posts: n/a
|
Check this out..
http://www.netomatix.com/development...ideColumn.aspx "ghostwolf" <> wrote in message news:... > Hi, I want to hide a column in the asp:GridView, say one of the column of > asp:BoundField. But it is not allowed to put <div> inside for setting it > display:none. What can I do? Thanks in millions. > Winista |
|
|
|
#7 |
|
Posts: n/a
|
"Winista" <> wrote in message
news:... > Check this out.. > > http://www.netomatix.com/development...ideColumn.aspx Correct approach, terrible implementation! Need to set display to either none or block to make this work properly. Mark Rae |
|
|
|
#8 |
|
Posts: n/a
|
Thank you for pointing out the issue with the approach. It has been fixed on
the site as well as attached demo project. "Mark Rae" <> wrote in message news:... > "Winista" <> wrote in message > news:... > >> Check this out.. >> >> http://www.netomatix.com/development...ideColumn.aspx > > Correct approach, terrible implementation! > > Need to set display to either none or block to make this work properly. > Winista |
|
|
|
#9 |
|
Posts: n/a
|
"Winista" <> wrote in message
news:u$WE8%... > Thank you for pointing out the issue with the approach. It has been fixed > on the site as well as attached demo project. Excellent. Check this out for cross-browser compatibility http://www.quirksmode.org/css/display.html, but I think you're OK... Mark Rae |
|
|
|
#10 |
|
Posts: n/a
|
Thanks, it's great for me.
"Mark Rae" <> wrote in message news:umI5vD%... > "Winista" <> wrote in message > news:u$WE8%... > >> Thank you for pointing out the issue with the approach. It has been fixed >> on the site as well as attached demo project. > > Excellent. Check this out for cross-browser compatibility > http://www.quirksmode.org/css/display.html, but I think you're OK... > ghostwolf |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How To Disable Or Hide EXPLORER TOOLBARS IN HTML PAGES | Corona | Media | 1 | 10-11-2006 02:26 PM |
| Disable Hide Explorer Toolbars In Html | Corona | Software | 0 | 10-08-2006 09:57 PM |
| DataGrid-Hyperlink column | thiyag2001 | Software | 2 | 08-01-2006 12:50 PM |
| Invalid column name | space | Software | 2 | 07-24-2006 07:41 PM |
| Counting In Binary | Raymond | A+ Certification | 13 | 03-07-2004 07:28 PM |