473,789 Members | 2,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make one cell in gridview invisible?

Jo
Hi all,

I have a gridview displaying a dataset and some buttons. When a certain
cell of this datasetrow is empty, I want a button in that row to be
visible, otherwise no button should be shown in that row.

I'm trying to make this work all day, but it's not going to work.

I tried this in the rowCreated event. I am able to find the right row
and cell in this row (as a datarow), but now the right gridview
row-cell should be made visible.

This is what I have right now (C#):

protected void supplierFilesGr id_RowCreated(o bject sender,
GridViewRowEven tArgs e)
{
if (e.Row.RowType == DataControlRowT ype.DataRow)
{
DataRowView drView = (DataRowView)e. Row.DataItem;
DataRow drRow = drView.Row;

if (drRow[2].ToString() == "NEW")
{
int i = e.Row.RowIndex; //
this works fine, after this I get an error:
//grid.Rows[i].Cells[1].Visible = false; //
argumentOutOfRa ngeException...
(sender as GridView).Rows[i].Cells[1].Visible =
false;
}
}
}

Has anyone a suggestion how to make this work?

Thanks in advance!

Regards,
Jo

Apr 6 '06
11 15012
It's not Controls[7]. Similar to Cell[7].Controls[0]

Apr 7 '06 #11
Jo
Thanks for your support!
Now it's working:

e.Row.Cells[7].Controls[1].Visible = false;

Thank you!
Jo

Apr 10 '06 #12

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

Similar topics

3
1674
by: Matt | last post by:
Are there any settings to make a page invisible to the user until certain time? For example, I want mypage.html is invisible to the user until 12:00am. But mypage.html is already in the IIS server. any ideas? thanks!
1
4209
by: PCB | last post by:
Hi all, Not sure if this is possible, but can I change the controls of a command button on a per record bases in a subform. In my case, I would like to make a command button visible only if certain fields in a table are a certain value. The buttons are adjacent to each record (i.e. - if there are 5 records, there would be 5 buttons; 10 records, 10 buttons; etc.) Here is the subroutine I've written so far: Public Sub IsButtonVisible()
3
2163
by: Richard | last post by:
After printing a userlist to a Datagrid i want some names not to be shown. I want to know how i can make a entire datagrid row invisible. I suspect its something with the OnItemDatabound but i am kinda stuck there. but this is basicly what i want. if Username = "Deleted_User" then 'make entire table row invisible. End if
0
385
by: Roy | last post by:
What is the best way to approach this problem? I have a datagrid with an imagebutton. When one clicks the imagebutton it triggers an onClick sub which makes column 9 (a user control) visible or invisible. Only problem is when one clicks the imagebutton on a specific row, I want *only* that row's column 9 to appear or disappear. ********My imagebutton******************* <asp:TemplateColumn><ItemTemplate> <asp:ImageButton...
6
14700
by: Selden McCabe | last post by:
I have a form with a bunch of image buttons. When the user moves the mouse over a button, I want to do two things: 1. change the Imagebutton's picture, and 2. make another control visible. I'm using the Imagebutton.Attributes.Add("onMouseOver","this.src = 'somepicture.jpg') and that works fine. I've tried some java script to change the other control's visible property by changing is className, but that doesn't seem to work
3
1847
by: david | last post by:
I have posted my question before. It seems that I can not find the solution. The question: I have datasource, say, ds which is bounded to a datagrid, dg. Assume that ds have 5 columns, c0,c1,c2,c3,c4. In some case, say, case 1, I want to display columns c0, c1,c2 in dg and use c3 and c4 in code behind. In case 2, I want to display column c0, c3, and c4, and use c1 and c2 in code behind. The following Possible solution do not work:
1
1481
by: indoo | last post by:
Javascript to make a character invisible in a texbox on onfocus event. Thanks in Advance.
0
3145
by: sony.m.2007 | last post by:
Hi, I'm creating a combox control in XAML(WPF) and loading the items from a table in sql server. There are four items in the combobox.I need to hide an item in the combobox and to show three items to the user.I don't want to remove and add items after binding the data from table I tried to find any properties{in items) to make an item invisible in combobox, but didn't find any properties to make an item invisible.Is there any...
1
2053
by: riyazuddin | last post by:
how to make a character invisible when the user is typing from keyboard in linux
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.