473,383 Members | 1,868 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,383 software developers and data experts.

Specified argument was out of the range of valid values

RN1
I have a DataGrid with 7 BoundColumns. A user can login as an admin or
non-admin. When a user logs in as a non-admin & the DatGrid is in the
editable mode, I want only the first 4 columns i.e. the TextBoxes in
the first 4 columns to be editable & the remaining 3 TextBoxes should
remain disabled. This is what I tried (in the OnItemDataBound event
functions):

--------------------
If (sessAdmin = 0) Then
For i = 4 To 6
CType(ea.Item.Cells(i).Controls(0), TextBox).Enabled = False
Next
End If
--------------------

But the above code generates the following error:

--------------------
Specified argument was out of the range of valid values.
Parameter name: index
--------------------

Since the columns are BoundColumns, if I am not mistaken, the
TextBoxes (when the DataGrid is in the editable mode) ought to be
Controls(0) & Cells(4) to Cells(6) are very much present. So why is
this error getting generated?

I even tried the above code in the OnEditCommand event function of the
DataGrid but the same error gets generated.
Oct 14 '08 #1
1 2019
My first move would be just to use UBound and/or Count to make sure my
assumptions are valid.

--
Patrice
"RN1" <rn**@rediffmail.coma écrit dans le message de groupe de discussion
: f3**********************************...oglegroups.com...
I have a DataGrid with 7 BoundColumns. A user can login as an admin or
non-admin. When a user logs in as a non-admin & the DatGrid is in the
editable mode, I want only the first 4 columns i.e. the TextBoxes in
the first 4 columns to be editable & the remaining 3 TextBoxes should
remain disabled. This is what I tried (in the OnItemDataBound event
functions):

--------------------
If (sessAdmin = 0) Then
For i = 4 To 6
CType(ea.Item.Cells(i).Controls(0), TextBox).Enabled = False
Next
End If
--------------------

But the above code generates the following error:

--------------------
Specified argument was out of the range of valid values.
Parameter name: index
--------------------

Since the columns are BoundColumns, if I am not mistaken, the
TextBoxes (when the DataGrid is in the editable mode) ought to be
Controls(0) & Cells(4) to Cells(6) are very much present. So why is
this error getting generated?

I even tried the above code in the OnEditCommand event function of the
DataGrid but the same error gets generated.

Oct 14 '08 #2

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

Similar topics

20
by: Glenn Venzke | last post by:
I'm writing a class with a method that will accept 1 of 3 items listed in an enum. Is it possible to pass the item name without the enum name in your calling statement? EXAMPLE: public enum...
3
by: Michael Conroy | last post by:
Hi... Synposis... Throws exception: "Specified argument was out of the range of valid values." Read on for the juicy tidbits. MySimpleClassCol mscc=new MySimpleClassCol(); private void...
4
by: Todd Perkins | last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually rely on google. So I hope I have enough info contained. Thank you in advance for any help! Problem: I am getting...
9
by: subdhar | last post by:
I'm getting following error in asp.net application.I search the web and couldn't find error like this can any one help me in trouble with this error Specified argument was out of the range of...
0
by: darrel | last post by:
What does this error mean? Specified argument was out of the range of valid values. Parameter name: value System.Web It's being thrown here: DDL_SubCategory.Enabled = True...
0
by: rajarameshvarma | last post by:
Hi.... I have a serious problem while deploying my asp.net application. I have developed a web project in which everypage contains Header, Left navigation and footer as usercontrols. For center...
1
by: IndiraPriyaDarshini | last post by:
Hi , Am trying to sum the total in the footer if a gridview, but am getting the error "Specified argument was out of the range of valid values. Parameter name: index "..Its Printing one cell value...
6
by: rhepsi | last post by:
Hi All... I Came across this error while populating a combobox from a datatable (I'm working in VB.NET): Specified argument was out of the range of valid values. Parameter name: '-1' is not a...
0
by: gsauns | last post by:
I have a DetailsView which is inside of a FormView. I lifted this DetailsView straight off another one of my pages, where it was working beautifully. Now I get this endlessly frustrating error...
2
by: Chapi | last post by:
hi, i'm having problems with a datagrid paging. it's populates fine, but when i click the paging button appears this error:"Specified argument was out of the range of valid values.Parameter name:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.