473,738 Members | 11,146 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.C ells(i).Control s(0), TextBox).Enable d = 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 2026
My first move would be just to use UBound and/or Count to make sure my
assumptions are valid.

--
Patrice
"RN1" <rn**@rediffmai l.coma écrit dans le message de groupe de discussion
: f3************* *************** **...legroups .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.C ells(i).Control s(0), TextBox).Enable d = 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
4849
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 EnumName FirstValue = 1 SecondValue = 2 ThirdValue = 3
3
3478
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 InitCombo() {
4
16981
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 this error when I try to pull up my edit page to display the current database information in the form, and then edit it on click:
9
5811
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 valid values. Parameter name: U Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
0
1400
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 DDL_SubCategory.DataSource = DS
0
3498
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 court i have used Ifrmae tag to call an HTML page. It was working fine for most of the pages it is working fine. But for some pages...user controls are rendered correctly ... but htnl page which is in the frame giving error.
1
2618
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 in the footer.. But for the seond sum,it showing the error, the value is getting, Help me pls.. Here is the ode snippent
6
3681
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 valid value for 'index'
0
1533
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 message whenever I try to go into Edit mode: Specified argument was out of the range of valid values. Parameter name: index The DetailsView is actually inside an UpdatePanel, which is inside an Ajax Accordion, which is inside the FormView. Could...
2
3087
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: index" I paste the code here in case someone can help me. Sub paginaNueva(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) DataGrid1.CurrentPageIndex = e.NewPageIndex
0
8969
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
8788
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
9335
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...
0
9208
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...
1
6751
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
4570
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
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
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
3
2193
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.