HighTechTalks DotNet Forums  

Setting Visibility on Gridview items after they are created?

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss Setting Visibility on Gridview items after they are created? in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
jc
 
Posts: n/a

Default Setting Visibility on Gridview items after they are created? - 12-11-2007 , 05:28 PM






I have a situation where I need to condition gridview item visibilty
after they've been created and after a textbox on page has a value.
What's the best way to do this in VB.NET? Any code sample?

I would imagine i have to loop through the control to do this.

Seems like it might be messy.

Reply With Quote
  #2  
Old   
Michael Nemtsev
 
Posts: n/a

Default RE: Setting Visibility on Gridview items after they are created? - 12-11-2007 , 06:00 PM






I suppose the looping of control hierarchy is the single way,
because your items are inside other control and u need find them somehow

--
WBR, Michael Nemtsev [.NET/C# MVP].
Blog: http://spaces.live.com/laflour



"jc" wrote:

Quote:
I have a situation where I need to condition gridview item visibilty
after they've been created and after a textbox on page has a value.
What's the best way to do this in VB.NET? Any code sample?

I would imagine i have to loop through the control to do this.

Seems like it might be messy.


Reply With Quote
  #3  
Old   
Eliyahu Goldin
 
Posts: n/a

Default Re: Setting Visibility on Gridview items after they are created? - 12-12-2007 , 04:19 AM



Do it in the PreRender event.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Michael Nemtsev" <nemtsev (AT) msn (DOT) com> wrote

Quote:
I suppose the looping of control hierarchy is the single way,
because your items are inside other control and u need find them somehow

--
WBR, Michael Nemtsev [.NET/C# MVP].
Blog: http://spaces.live.com/laflour



"jc" wrote:

I have a situation where I need to condition gridview item visibilty
after they've been created and after a textbox on page has a value.
What's the best way to do this in VB.NET? Any code sample?

I would imagine i have to loop through the control to do this.

Seems like it might be messy.




Reply With Quote
  #4  
Old   
jc
 
Posts: n/a

Default Re: Setting Visibility on Gridview items after they are created? - 12-12-2007 , 06:57 AM



Does anybody have any vb.net example of looping through the gridview
and setting visibility of an item after it's been built?

Reply With Quote
  #5  
Old   
gnewsgroup
 
Posts: n/a

Default Re: Setting Visibility on Gridview items after they are created? - 12-12-2007 , 08:38 AM



On Dec 12, 6:57 am, jc <j... (AT) webdos (DOT) com> wrote:
Quote:
Does anybody have any vb.net example of looping through the gridview
and setting visibility of an item after it's been built?
I think you can do something like this (in C#, I am not good at VB):

foreach (GridViewRow gvr in MyGridView.Rows)
{
// If you know the column index, you can do:
gvr.Cells[2].Visible = false;
// Or if you want to make some control in that cell
invisible:
TextBox myTextBox = (TextBox)gvr.FindControls("myTextBox");
myTextBox.Visible = false;
}

The code hasn't been tested, but you get the idea.


Reply With Quote
  #6  
Old   
gnewsgroup
 
Posts: n/a

Default Re: Setting Visibility on Gridview items after they are created? - 12-12-2007 , 08:56 AM



On Dec 12, 6:57 am, jc <j... (AT) webdos (DOT) com> wrote:
Quote:
Does anybody have any vb.net example of looping through the gridview
and setting visibility of an item after it's been built?
It's been answered here:

http://groups.google.com/group/micro...23a8cca6231531


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.