473,796 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set Enabled or Visible on gridview cell contols?

Can I set the Enabled or Visible properties of the controls (textboxes,
checkboxes) displayed by default in edit mode, depending on the value of some
other column? Or must I convert the column to a template column first? What I
mean is, I can correctly get the value of the default textbox in a gridview
cell when edited, using:

s = CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).Text

but I can't set that textbox to disabled or hidden using

CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).enable d=false or
CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).visibl e=false

although I have intellisence for them.
The message I get is:
"Specified argument was out of the range of valid values. Parameter name:
index"

Why?
Sep 7 '08 #1
5 3822
Also, how can I change the ReadOnly property of a field, when it's about to
enter the edit mode?
Sep 7 '08 #2
You must've been looking in different places.

In the same place, if you don't get an exception because of index in
s = CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).Text

you can't get it in
CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).enable d=false

since index is used before you get to Enabled property.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Savvoulidi s Iordanis" <Sa************ *****@discussio ns.microsoft.co mwrote
in message news:45******** *************** ***********@mic rosoft.com...
Can I set the Enabled or Visible properties of the controls (textboxes,
checkboxes) displayed by default in edit mode, depending on the value of
some
other column? Or must I convert the column to a template column first?
What I
mean is, I can correctly get the value of the default textbox in a
gridview
cell when edited, using:

s = CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).Text

but I can't set that textbox to disabled or hidden using

CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).enable d=false
or
CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).visibl e=false

although I have intellisence for them.
The message I get is:
"Specified argument was out of the range of valid values. Parameter name:
index"

Why?

Sep 8 '08 #3
RowEditing event should be good for this.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Savvoulidi s Iordanis" <Sa************ *****@discussio ns.microsoft.co mwrote
in message news:C3******** *************** ***********@mic rosoft.com...
Also, how can I change the ReadOnly property of a field, when it's about
to
enter the edit mode?

Sep 8 '08 #4
What I need is a code excerpt. I couldn't manage to write it properly. I
can't event get correct object reference to have intellisence for .Readonly
Sep 9 '08 #5
Boh the following statements are used in RowCommand event. The 2nd one gives
the exception

s = CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).Text

CType(grd_users .Rows(index).Ce lls(4).Controls (0), TextBox).enable d=false

Why?
Sep 9 '08 #6

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

Similar topics

2
3601
by: Chris Davoli | last post by:
How do you enable a check box in the GridView. I selected Checkbox Field in the Columns of the GridView, and the check box shows up in the Grid view, but it is disabled. How do I enable it so I can check/uncheck it. Also, what event do I use to check it for a value? Any articles out there? -- Chris Davoli
7
10389
by: aljamala | last post by:
Hi, I was wondering if there is a way to make a single cell readonly within a GridView? I know you can do it for a column but what about a cell within that column? Thanks!
1
5923
by: jobs | last post by:
Can somebody tell me why Jobno and Value BoundFields are not available during the command SaveParm ? i enter text into the box for Value and hit the Save button, but all I see is the Parmvalue. Thanks in advance for any help or information!!
3
3311
by: Bill Gower | last post by:
I have an cell which contains a field member which is filled with String.Empty. When I retrieve the value in the cell with Cells.Text.ToString() and try to compare it to String.Empty, I can't because it contains "&nbsp". I really don't want to compare the value to that so how can I retrieve an empty cell so that it is String.Empty. Bill
3
8878
by: jc | last post by:
Hello. I have a gridview column item that i want to not make visible if the bound data in that cell is less than a value in a textbox. However, I notice at the time my code checks a function that I call from the visible property of the gridview itemtemplate, the textbox is always blank. I tried setting the textbox in the prerender, but I suspect the
0
1136
by: mattd1 | last post by:
I'm using VS2008, and I need to put a gridview into a table cell (an asp table). I made the gridview and set it all up outside the table, then I edit the HTML and move the gridview into the table cell it should go into, but then it doesn't show no matter what I do. It's like it's invisible. If I drag the HTML that describes the gridview out of the table cell and on its own, the gridview shows fine. Is there some problem with putting a...
1
4522
Frinavale
by: Frinavale | last post by:
I'm working on an ASP.NET application using VB.NET for server side code. I have a GridView listing a bunch of stuff. Above the GridView I have a checkbox named "ChkBx_SelectAll". If this checkbox is checked, all of the rows in the GridView are checked, if this checkbox is unchecked, all of the rows in the GridView are unchecked. This checking/unchecking of the checkboxes in the GridView is handled by a JavaScript method: function...
4
5865
by: foolmelon | last post by:
Before AJAX, we were able to focus a cell in a gridview during a fullpage postback. After putting the gridview inside an UpdatePanel, we cannot focus a cell in this gridview anymore. Does anybody know if it is possible to make such focus? Thanks! Bill
9
12099
by: ally | last post by:
Hi, I am programmatically binding gridview to a datatable. I want to hide 2 columns. I can be done by adding code in RowCreated event of gridview like e.Row.Cells.Visible = false; e.Row.Cells.Visible = false; but after that paging is not working. I tried another way by using gridview's column.Visible property but its giving error
0
9685
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
10242
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10200
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,...
0
10021
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
9061
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, 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...
1
7558
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 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...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4127
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
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.