473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

FindControl with GridView

Hello,

I have the following GridView. I need to be able to get to the DataFields
and set the Visible property. Any help with this would be appreciated.

Thanks, sck10
<!-- Grid: List of all the Services from the Textbox -->
<asp:GridView ID="gvSearchData" runat="server"
DataSourceID="dsSearchData"
DataKeyNames="Handle"
Width="100%">
<Columns>
<asp:BoundField DataField="strFullName"
Visible="true"
HeaderText="Name"
SortExpression=""
HeaderStyle-Cssclass="BlkB"
HeaderStyle-VerticalAlign="Bottom"
ItemStyle-HorizontalAlign="left"
ItemStyle-Width="15%" />

<asp:CheckBoxField DataField="IsActive"
Visible="true"
HeaderText="Active"
SortExpression=""
HeaderStyle-Cssclass="BlkB"
HeaderStyle-VerticalAlign="Bottom"
ItemStyle-HorizontalAlign="center"
ItemStyle-Width="7%" />
</Columns>
</asp:GridView>
Apr 25 '07 #1
2 8493
if it is the column that you wish to set globally, then
[C#]
gvSearchData.Columns[1].Visible = false;

[VB.NET]
gvSearchData.Columns(1).Visible = False

"sck10" <sc***@online.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hello,

I have the following GridView. I need to be able to get to the DataFields
and set the Visible property. Any help with this would be appreciated.

Thanks, sck10
<!-- Grid: List of all the Services from the Textbox -->
<asp:GridView ID="gvSearchData" runat="server"
DataSourceID="dsSearchData"
DataKeyNames="Handle"
Width="100%">
<Columns>
<asp:BoundField DataField="strFullName"
Visible="true"
HeaderText="Name"
SortExpression=""
HeaderStyle-Cssclass="BlkB"
HeaderStyle-VerticalAlign="Bottom"
ItemStyle-HorizontalAlign="left"
ItemStyle-Width="15%" />

<asp:CheckBoxField DataField="IsActive"
Visible="true"
HeaderText="Active"
SortExpression=""
HeaderStyle-Cssclass="BlkB"
HeaderStyle-VerticalAlign="Bottom"
ItemStyle-HorizontalAlign="center"
ItemStyle-Width="7%" />
</Columns>
</asp:GridView>

Apr 25 '07 #2
Thanks Brandon,

Just what I was looking for...

sck10
"Brandon Driesen" <de*********@user.comwrote in message
news:13*************@corp.supernews.com...
if it is the column that you wish to set globally, then
[C#]
gvSearchData.Columns[1].Visible = false;

[VB.NET]
gvSearchData.Columns(1).Visible = False

"sck10" <sc***@online.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>Hello,

I have the following GridView. I need to be able to get to the
DataFields and set the Visible property. Any help with this would be
appreciated.

Thanks, sck10
<!-- Grid: List of all the Services from the Textbox -->
<asp:GridView ID="gvSearchData" runat="server"
DataSourceID="dsSearchData"
DataKeyNames="Handle"
Width="100%">
<Columns>
<asp:BoundField DataField="strFullName"
Visible="true"
HeaderText="Name"
SortExpression=""
HeaderStyle-Cssclass="BlkB"
HeaderStyle-VerticalAlign="Bottom"
ItemStyle-HorizontalAlign="left"
ItemStyle-Width="15%" />

<asp:CheckBoxField DataField="IsActive"
Visible="true"
HeaderText="Active"
SortExpression=""
HeaderStyle-Cssclass="BlkB"
HeaderStyle-VerticalAlign="Bottom"
ItemStyle-HorizontalAlign="center"
ItemStyle-Width="7%" />
</Columns>
</asp:GridView>


Apr 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phil | last post by:
asp.net 2.0 i have this scenario: <loginview> <loggedintemplate> <formview_1> <gridview> <formview_2>
3
by: Martin | last post by:
Hi, I have a very frustrating problem that I have researched for countless hours to no avail. There are many posts asking very similar things, however none usefull in my situation. I am using VS...
0
by: K B | last post by:
PLEASE be patient and read this. I believe I've actually reached the end of the Web trying to find the answer! I have an aspx using a MasterPage with a ContentPlaceholder. I have a datatable...
6
by: MRW | last post by:
Hello! I have a problem, I can't seem to solve. I'm making a class in my page that will hold the members of a FormView, so I can access them freely throughout the several functions and...
11
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I am trying to get the text of an item in a GridView, but am doing something wrong. Can someone help me with the correct C# statement I need? Below is my GridView and my attempt to get the control....
2
by: kevin | last post by:
Hi. I'm ripping my hair out. I'm in VS 2005 Framework 2. I have one website with a gridview with some template fields. I'm using the footer row to insert records. For this discussion there is a...
1
by: Andrew Robinson | last post by:
I am using the following code to preload a few controls in the FooterRow within a GridView control: protected void Page_Load(object sender, EventArgs e) {...
4
by: beton3000 | last post by:
Hello! I'm building a GridView using code to add template fields, because there is a random number of columns in result set from database. I'm using a class with ITemplate interface for defining...
4
by: Craig Buchanan | last post by:
I dynamically add data-bound templates to a gridview in my ascx control. while this works correctly when the gridview is databound to the datatable, i'm having issues on postback. i would like...
1
by: =?Utf-8?B?U2F2dm91bGlkaXMgSW9yZGFuaXM=?= | last post by:
How can I use Findcontrol inside a master gridview's RowDatabound event to search for another gridview (detail) control that is inside an ASP Panel, in a template column of the master gridview?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.