Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > CType(e.Item.Cells(3).Controls(1), textbox) fails when key is set to READONLY

Reply
Thread Tools

CType(e.Item.Cells(3).Controls(1), textbox) fails when key is set to READONLY

 
 
Keith-Earl
Guest
Posts: n/a
 
      07-14-2004
The code could not be simpler:
Dim txtProjectID As TextBox = CType(e.Item.Cells(1).Controls(0), TextBox)

Dim dblProjectID As Double = CDbl(txtProjectID.Text)


Run-time exception thrown : System.ArgumentOutOfRangeException - Specified
argument was out of the range of valid values.
Parameter name: index

e.Item.Cell(1) is valid. When I take away the READONLY attribute everything
works fine. What is really bizzare is that ALL Cells throw the same error
when I set the READONLY attribute to TRUE. When I remove it I can reference
all Cells in the Quickwatch window and in code. ProjectID is one of two
keys. The end-user should never change my keys in this app.

To make it even more interesting, I have another simple app (simple
code/description table) that does not exhibit this behavior.

What gives?

Keith


 
Reply With Quote
 
 
 
 
MA
Guest
Posts: n/a
 
      07-14-2004

"Keith-Earl" <css@NO_SPAMConsultWithUs.com> wrote in message
news:(E-Mail Removed)...
> The code could not be simpler:
> Dim txtProjectID As TextBox = CType(e.Item.Cells(1).Controls(0), TextBox)
>
> Dim dblProjectID As Double = CDbl(txtProjectID.Text)
>
>
> Run-time exception thrown : System.ArgumentOutOfRangeException - Specified
> argument was out of the range of valid values.
> Parameter name: index
>
> e.Item.Cell(1) is valid. When I take away the READONLY attribute

everything
> works fine. What is really bizzare is that ALL Cells throw the same error
> when I set the READONLY attribute to TRUE. When I remove it I can

reference
> all Cells in the Quickwatch window and in code. ProjectID is one of two
> keys. The end-user should never change my keys in this app.
>
> To make it even more interesting, I have another simple app (simple
> code/description table) that does not exhibit this behavior.
>
> What gives?
>
> Keith
>
>


When e.Item.Cells(1).Controls(0) is read only, there is no TextBox in it.
Get the value via a string instead. I donīt use VB usually, but it could
look like this in C# (without testing :
string strProjectID = e.Item.Cells(1).Text;

/Marre


 
Reply With Quote
 
 
 
 
Keith-Earl
Guest
Posts: n/a
 
      07-14-2004
Will try that and report back.

Please explain why I have a SIMPLE code/description table where the PK is
READONLY and it works.


 
Reply With Quote
 
Keith-Earl
Guest
Posts: n/a
 
      07-14-2004
Please read MA's post and my follow up. Thanks for helping.


 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      07-14-2004
It's just a guess. Could be that if you set ReadOnly, the control renders as
internal cell text and not as a control? Then Controls(0) would throw an
exception.

Eliyahu

"Keith-Earl" <css@NO_SPAMConsultWithUs.com> wrote in message
news:(E-Mail Removed)...
> The code could not be simpler:
> Dim txtProjectID As TextBox = CType(e.Item.Cells(1).Controls(0), TextBox)
>
> Dim dblProjectID As Double = CDbl(txtProjectID.Text)
>
>
> Run-time exception thrown : System.ArgumentOutOfRangeException - Specified
> argument was out of the range of valid values.
> Parameter name: index
>
> e.Item.Cell(1) is valid. When I take away the READONLY attribute

everything
> works fine. What is really bizzare is that ALL Cells throw the same error
> when I set the READONLY attribute to TRUE. When I remove it I can

reference
> all Cells in the Quickwatch window and in code. ProjectID is one of two
> keys. The end-user should never change my keys in this app.
>
> To make it even more interesting, I have another simple app (simple
> code/description table) that does not exhibit this behavior.
>
> What gives?
>
> Keith
>
>



 
Reply With Quote
 
MA
Guest
Posts: n/a
 
      07-15-2004

"Keith-Earl" <css@NO_SPAMConsultWithUs.com> wrote in message
news:(E-Mail Removed)...
> Will try that and report back.
>
> Please explain why I have a SIMPLE code/description table where the PK is
> READONLY and it works.
>
>


Sorry, but I donīt know if I understand what you mean.

/Marre


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python 2.6 SSL module: Fails on key file error, with Errno 336265225,without a key file. John Nagle Python 2 04-19-2010 04:35 PM
Replace Tab Key to Return Key (Enter Key) from Web Forms? M P ASP General 1 08-06-2004 08:32 AM
ASP.NET Readonly panel function with readonly checkbox, readonly radiobutton Jonathan Hyatt ASP .Net Web Controls 1 06-08-2004 07:42 PM
set ReadOnly to radio button and check box Grey ASP .Net 1 05-31-2004 10:00 AM



Advertisments