473,747 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to dynamically enable/disable row editing in GridView control (ASP.NET 2.0) ?

Hi all.

I would like to know if it is possible to dynamically enable/disable
row editing in GridView control in ASP.NET 2.0. I am asking because
this feature should be enabled/disable depending on button, which was
clicked by user.

Thanks in advance,

Feb 28 '06 #1
5 19070

You can put a row in edit mode with:

GridView1.EditI ndex

EditIndex gets or sets the row to edit.


S. Justin Gengo, MCP
Web Developer / Programmer


"Out of chaos comes order."
"misiek" <pt*********@po czta.fm> wrote in message
news:11******** **************@ t39g2000cwt.goo glegroups.com.. .
Hi all.

I would like to know if it is possible to dynamically enable/disable
row editing in GridView control in ASP.NET 2.0. I am asking because
this feature should be enabled/disable depending on button, which was
clicked by user.

Thanks in advance,

Feb 28 '06 #2
Justin, I know that.

What I meant was not to enable editing of certain row in GridView, but
enabling/disabling Edit button, which is used for editing.
I use standard Edit button from designer. I would like it to be visible
only in certain circumstances.

Do you know how it can be done?


Feb 28 '06 #3

Mar 3 '06 #4
There are a number of ways to do this. If you just want to remove the
button from a row, you can use:

row.Cells[0].Controls.Clear ();

Assuming that your edit button is in the first column. You can also
convert it to a TemplateColumn and hide it like you would any control
in a grid.


Mar 3 '06 #5
Thanks carl.

I did it in such way: GridViewPI.Colu mns[1].Visible = false;

Mar 4 '06 #6

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

Similar topics

by: Steve | last post by:
When coding in vbscript asp, I did everything from scratch and could control the way that for example my data tables looked and could be edited. I for example could allow the user to delete multiple records by selecting them via checkboxes and clicking on one 'delete' button. They could edit a particular record by clicking on the value of a particular field (e.g. username) and editing that record. Now I am a bit confused, can I still...
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I want to look at that data and filter it based on what is in it. I know that this could have been done with data sets and data views in asp.net 1.1 but how is this done now in asp.net 2.0?
by: keithb | last post by:
I have a GridView control that has a delete button (hyperlink) in one column. The datasource table contains a column that has a true/false indicator showing whether or not the record can be deleted. How can I enable/disable the delete button depending on the value of the indicator? Ideally, I would like to make the button invisible where a record cannot be deleted. Thanks, Keith
by: John Smith | last post by:
ASP.Net 2.0 / C# / IIS 6 I have 2 pages. The master page consists of a tabbed menu created using the Menu and MultiView controls. Something like this: http://fredrik.nsquared2.com/viewpost.aspx?PostID=344&showfeedback=true The second page is a user control that contains a GridView control linked to a database table. What's supposed to happen is that the user clicks on a menu choice and an appropriate user control will load. For...
by: rn5a | last post by:
In a shopping cart app, assume that a user has placed 4 orders (each order has a corresponding OrderID which will be unique). When he comes to MyCart.aspx, by default, the details of his last order he had placed will be displayed in a DataList. Also assume that the OrderID of the last order is 13. The details of the earlier orders placed by a particular user (when the user places more than 1 order) can be viewed by clicking links. The...
by: abehm | last post by:
Hey all, I'm trying to disable a couple controls if a user clicks on a certain item in a dropdown list. I can do it on postback, but if someone could help me to do it dynamically, that would be key! Thanks in advance! Aaron
by: Mel | last post by:
I want to disable the editing of a row in my gvParts GridView control. How? I need to evaluate the value of one Template Field to determine if the record should be edited or not but the template field always returns an empty string. Any ideas?
by: sanndeb | last post by:
I want to enable/disable controls of a asp.net page against a logged in user's permission. say 'admin' & 'hr' can change user's birth date text-box in a page but others will see the text-box as disabled. so i wrote a function like this public enum UserRoles { GroupLead = 0x2, WebAdmin = 0x4, Developers = 0x8, Hr = 0x10,
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...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.