Can't get the value of a text box using it's ID

Can't get the value of a text box using it's ID

Post by Michael Owe » Sat, 17 Aug 2002 00:35:33



What am I doing wrong?

I have a text box within template in a DataGrid control
with the ID of grdPackages__ctl3_txtOrderQty'.  Most of
the ID has been generated automatically by asp.Net.  The
name I gave it was 'txtOrderQty'.

If I try to get the value of this text box once the form
has been submitted, using:

    Request.Form("grdPackages__ctl4_txtOrderQty")

The value is a zero length string, yet I can see the
value is in fact a zero, i.e. "0".

Interestingly if use Request.Form(2), the correct value
is returned.

Why is the correct value not returned?

Is there an easier way of getting the values returned
from text boxes within a template on a DataGrid control?

Many thanks, Mike.

 
 
 

Can't get the value of a text box using it's ID

Post by matthew curr » Sat, 17 Aug 2002 01:03:36


use findcontrol() on the item you get out of the datagrid
submission

i.e
Dim str1 As String = CType(e.Item.FindControl
("txtOrderQty"), TextBox).Text

Quote:>-----Original Message-----
>What am I doing wrong?

>I have a text box within template in a DataGrid control
>with the ID of grdPackages__ctl3_txtOrderQty'.  Most of
>the ID has been generated automatically by asp.Net.  The
>name I gave it was 'txtOrderQty'.

>If I try to get the value of this text box once the form
>has been submitted, using:

>    Request.Form("grdPackages__ctl4_txtOrderQty")

>The value is a zero length string, yet I can see the
>value is in fact a zero, i.e. "0".

>Interestingly if use Request.Form(2), the correct value
>is returned.

>Why is the correct value not returned?

>Is there an easier way of getting the values returned
>from text boxes within a template on a DataGrid control?

>Many thanks, Mike.
>.


 
 
 

Can't get the value of a text box using it's ID

Post by Patrick C. Cole ( » Sun, 18 Aug 2002 04:00:48


Michael,

Where are you attempting to get the value of the textbox?  In what event on
PostBack?

Patrick Cole
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
reserved.
--------------------
| Content-Class: urn:content-classes:message


| Subject: Can't get the value of a text box using it's ID
| Date: Thu, 15 Aug 2002 08:35:33 -0700
| Lines: 25

| MIME-Version: 1.0
| Content-Type: text/plain;
|       charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcJEcWUHr7LHrgV+QVSQHd1LqqKGJQ==
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Path: cpmsftngxa06
| Xref: cpmsftngxa06
microsoft.public.dotnet.framework.aspnet.webcontrols:4642
| NNTP-Posting-Host: TKMSFTNGXA08 10.201.226.36
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| What am I doing wrong?
|
| I have a text box within template in a DataGrid control
| with the ID of grdPackages__ctl3_txtOrderQty'.  Most of
| the ID has been generated automatically by asp.Net.  The
| name I gave it was 'txtOrderQty'.
|
| If I try to get the value of this text box once the form
| has been submitted, using:
|
|     Request.Form("grdPackages__ctl4_txtOrderQty")
|
| The value is a zero length string, yet I can see the
| value is in fact a zero, i.e. "0".
|
| Interestingly if use Request.Form(2), the correct value
| is returned.
|
| Why is the correct value not returned?
|
| Is there an easier way of getting the values returned
| from text boxes within a template on a DataGrid control?
|
|
| Many thanks, Mike.
|

 
 
 

Can't get the value of a text box using it's ID

Post by Michael Owe » Wed, 21 Aug 2002 19:56:39


Patrick,

I am trying to get the value on a button onClick event,
i.e. in this case 'btnPlaceOrder_Click'.

I don't think the earlier suggestion by Mathew curry
would work - There is no way to iterate through each text
box automatically created by the Grid/Template control?

To expand slightly on what I am trying to do - I am
trying to iterate though all of the order quantity boxes
to see which items have been ordered.  I will then go on
to create the order for the items in a DB.

Thanks, Mike.

Quote:>-----Original Message-----
>Michael,

>Where are you attempting to get the value of the

textbox?  In what event on
Quote:>PostBack?

>Patrick Cole
>Microsoft Developer Support

>This posting is provided "AS IS" with no warranties, and
confers no rights.
>You assume all risk for your use. ? 2002 Microsoft

Corporation. All rights
>reserved.
>--------------------
>| Content-Class: urn:content-classes:message


>| Subject: Can't get the value of a text box using it's
ID
>| Date: Thu, 15 Aug 2002 08:35:33 -0700
>| Lines: 25
>| Message-ID: <2cea01c24471$6507abf0


Quote:>| MIME-Version: 1.0
>| Content-Type: text/plain;
>|   charset="iso-8859-1"
>| Content-Transfer-Encoding: 7bit
>| X-Newsreader: Microsoft CDO for Windows 2000
>| X-MimeOLE: Produced By Microsoft MimeOLE
V5.50.4910.0300
>| Thread-Index: AcJEcWUHr7LHrgV+QVSQHd1LqqKGJQ==
>| Newsgroups:

microsoft.public.dotnet.framework.aspnet.webcontrols
Quote:>| Path: cpmsftngxa06
>| Xref: cpmsftngxa06
>microsoft.public.dotnet.framework.aspnet.webcontrols:4642
>| NNTP-Posting-Host: TKMSFTNGXA08 10.201.226.36
>| X-Tomcat-NG:

microsoft.public.dotnet.framework.aspnet.webcontrols
Quote:>|
>| What am I doing wrong?
>|
>| I have a text box within template in a DataGrid
control
>| with the ID of grdPackages__ctl3_txtOrderQty'.  Most
of
>| the ID has been generated automatically by asp.Net.  
The
>| name I gave it was 'txtOrderQty'.
>|
>| If I try to get the value of this text box once the
form
>| has been submitted, using:
>|
>|     Request.Form("grdPackages__ctl4_txtOrderQty")
>|
>| The value is a zero length string, yet I can see the
>| value is in fact a zero, i.e. "0".
>|
>| Interestingly if use Request.Form(2), the correct
value
>| is returned.
>|
>| Why is the correct value not returned?
>|
>| Is there an easier way of getting the values returned
>| from text boxes within a template on a DataGrid
control?
>|
>|
>| Many thanks, Mike.
>|

>.

 
 
 

Can't get the value of a text box using it's ID

Post by Patrick C. Cole ( » Thu, 22 Aug 2002 00:19:39


Michael,

I see no reason why you could not iternate through a list of DataGridItems
for controls created in an ItemTemplate.  EditItemTemplate is a different
story.  In fact, if you are not updating the DataGrid via an Update_Command
event, I would think that enumerating the DataGridItems would be the only
solution.

I did not see the other post you are referring to, but here is a sample
that will loop through the DataGrid, locate the TextBox, and return the
text of each TextBox.

        // Modify "DataGrid1" to locate your DataGrid control
        DataGrid dgTemp = ((DataGrid)this.FindControl("DataGrid1"));

        // Loop through all DataGridItems in the DataGrid.
        foreach(DataGridItem dgiTemp in dgTemp.Controls[0].Controls)
        {
                // Check for Item or AlternatingItem DataGridItems.  Most likely you
                // will not have TextBoxes in the Header or Footer rows.
                if(dgiTemp.ItemType.ToString() == "Item" || dgiTemp.ItemType.ToString()
== "AlternatingItem")
                {
                        // "Test" is the ID of my TextBox.
                        TextBox tbTemp = ((TextBox)(dgiTemp.FindControl("Test")));
                        // Simply get the value and return it to the screen.
                        Response.Write(tbTemp.Text + "<br>");
                }
        }

Patrick Cole
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
reserved.
--------------------
| Content-Class: urn:content-classes:message




| Subject: RE: Can't get the value of a text box using it's ID
| Date: Tue, 20 Aug 2002 03:56:39 -0700
| Lines: 94

| MIME-Version: 1.0
| Content-Type: text/plain;
|       charset="iso-8859-1"
| Content-Transfer-Encoding: quoted-printable
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcJIOEMIT+k7zDRYQUCOdkoSf0V0tQ==
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: TKMSFTNGXA11 10.201.226.39
| Path: cpmsftngxa10!tkmsftngp01!cpmsftngxa07
| Xref: cpmsftngxa10
microsoft.public.dotnet.framework.aspnet.webcontrols:4737
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Patrick,
| I am trying to get the value on a button onClick event,
| i.e. in this case 'btnPlaceOrder_Click'.
| I don't think the earlier suggestion by Mathew curry
| would work - There is no way to iterate through each text
| box automatically created by the Grid/Template control?
| To expand slightly on what I am trying to do - I am
| trying to iterate though all of the order quantity boxes
| to see which items have been ordered.  I will then go on
| to create the order for the items in a DB.
| Thanks, Mike.

| >-----Original Message-----
| >Michael,
| >
| >Where are you attempting to get the value of the
| textbox?  In what event on
| >PostBack?
| >
| >Patrick Cole
| >Microsoft Developer Support
| >
| >This posting is provided "AS IS" with no warranties, and
| confers no rights.
| >You assume all risk for your use. ? 2002 Microsoft
| Corporation. All rights
| >reserved.
| >--------------------
| >| Content-Class: urn:content-classes:message


| >| Subject: Can't get the value of a text box using it's
| ID
| >| Date: Thu, 15 Aug 2002 08:35:33 -0700
| >| Lines: 25
| >| Message-ID: <2cea01c24471$6507abf0

| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >|         charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE
| V5.50.4910.0300
| >| Thread-Index: AcJEcWUHr7LHrgV+QVSQHd1LqqKGJQ==
| >| Newsgroups:
| microsoft.public.dotnet.framework.aspnet.webcontrols
| >| Path: cpmsftngxa06
| >| Xref: cpmsftngxa06
| >microsoft.public.dotnet.framework.aspnet.webcontrols:4642
| >| NNTP-Posting-Host: TKMSFTNGXA08 10.201.226.36
| >| X-Tomcat-NG:
| microsoft.public.dotnet.framework.aspnet.webcontrols
| >|
| >| What am I doing wrong?
| >|
| >| I have a text box within template in a DataGrid
| control
| >| with the ID of grdPackages__ctl3_txtOrderQty'.  Most
| of
| >| the ID has been generated automatically by asp.Net.  
| The
| >| name I gave it was 'txtOrderQty'.
| >|
| >| If I try to get the value of this text box once the
| form
| >| has been submitted, using:
| >|
| >|     Request.Form("grdPackages__ctl4_txtOrderQty")
| >|
| >| The value is a zero length string, yet I can see the
| >| value is in fact a zero, i.e. "0".
| >|
| >| Interestingly if use Request.Form(2), the correct
| value
| >| is returned.
| >|
| >| Why is the correct value not returned?
| >|
| >| Is there an easier way of getting the values returned
| >| from text boxes within a template on a DataGrid
| control?
| >|
| >|
| >| Many thanks, Mike.
| >|
| >
| >.
| >
|

 
 
 

Can't get the value of a text box using it's ID

Post by Brad Quin » Thu, 22 Aug 2002 05:27:39


Wouldn't it be easier to code;

    foreach(DataGridItem dgiTemp in dgTemp.Items)

instead of;

    foreach(DataGridItem dgiTemp in dgTemp.Controls[0].Controls)

Then you could do away with the ItemType test.  Couldn't you?



> Michael,

> I see no reason why you could not iternate through a list of DataGridItems
> for controls created in an ItemTemplate.  EditItemTemplate is a different
> story.  In fact, if you are not updating the DataGrid via an
Update_Command
> event, I would think that enumerating the DataGridItems would be the only
> solution.

> I did not see the other post you are referring to, but here is a sample
> that will loop through the DataGrid, locate the TextBox, and return the
> text of each TextBox.

> // Modify "DataGrid1" to locate your DataGrid control
> DataGrid dgTemp = ((DataGrid)this.FindControl("DataGrid1"));

> // Loop through all DataGridItems in the DataGrid.
> foreach(DataGridItem dgiTemp in dgTemp.Controls[0].Controls)
> {
> // Check for Item or AlternatingItem DataGridItems.  Most likely you
> // will not have TextBoxes in the Header or Footer rows.
> if(dgiTemp.ItemType.ToString() == "Item" || dgiTemp.ItemType.ToString()
> == "AlternatingItem")
> {
> // "Test" is the ID of my TextBox.
> TextBox tbTemp = ((TextBox)(dgiTemp.FindControl("Test")));
> // Simply get the value and return it to the screen.
> Response.Write(tbTemp.Text + "<br>");
> }
> }

> Patrick Cole
> Microsoft Developer Support

> This posting is provided "AS IS" with no warranties, and confers no
rights.
> You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
> reserved.
> --------------------
> | Content-Class: urn:content-classes:message




> | Subject: RE: Can't get the value of a text box using it's ID
> | Date: Tue, 20 Aug 2002 03:56:39 -0700
> | Lines: 94

> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | charset="iso-8859-1"
> | Content-Transfer-Encoding: quoted-printable
> | X-Newsreader: Microsoft CDO for Windows 2000
> | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
> | Thread-Index: AcJIOEMIT+k7zDRYQUCOdkoSf0V0tQ==
> | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
> | NNTP-Posting-Host: TKMSFTNGXA11 10.201.226.39
> | Path: cpmsftngxa10!tkmsftngp01!cpmsftngxa07
> | Xref: cpmsftngxa10
> microsoft.public.dotnet.framework.aspnet.webcontrols:4737
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
> |
> | Patrick,
> | I am trying to get the value on a button onClick event,
> | i.e. in this case 'btnPlaceOrder_Click'.
> | I don't think the earlier suggestion by Mathew curry
> | would work - There is no way to iterate through each text
> | box automatically created by the Grid/Template control?
> | To expand slightly on what I am trying to do - I am
> | trying to iterate though all of the order quantity boxes
> | to see which items have been ordered.  I will then go on
> | to create the order for the items in a DB.
> | Thanks, Mike.
> | >-----Original Message-----
> | >Michael,
> | >
> | >Where are you attempting to get the value of the
> | textbox?  In what event on
> | >PostBack?
> | >
> | >Patrick Cole
> | >Microsoft Developer Support
> | >
> | >This posting is provided "AS IS" with no warranties, and
> | confers no rights.
> | >You assume all risk for your use. ? 2002 Microsoft
> | Corporation. All rights
> | >reserved.
> | >--------------------
> | >| Content-Class: urn:content-classes:message


> | >| Subject: Can't get the value of a text box using it's
> | ID
> | >| Date: Thu, 15 Aug 2002 08:35:33 -0700
> | >| Lines: 25
> | >| Message-ID: <2cea01c24471$6507abf0

> | >| MIME-Version: 1.0
> | >| Content-Type: text/plain;
> | >| charset="iso-8859-1"
> | >| Content-Transfer-Encoding: 7bit
> | >| X-Newsreader: Microsoft CDO for Windows 2000
> | >| X-MimeOLE: Produced By Microsoft MimeOLE
> | V5.50.4910.0300
> | >| Thread-Index: AcJEcWUHr7LHrgV+QVSQHd1LqqKGJQ==
> | >| Newsgroups:
> | microsoft.public.dotnet.framework.aspnet.webcontrols
> | >| Path: cpmsftngxa06
> | >| Xref: cpmsftngxa06
> | >microsoft.public.dotnet.framework.aspnet.webcontrols:4642
> | >| NNTP-Posting-Host: TKMSFTNGXA08 10.201.226.36
> | >| X-Tomcat-NG:
> | microsoft.public.dotnet.framework.aspnet.webcontrols
> | >|
> | >| What am I doing wrong?
> | >|
> | >| I have a text box within template in a DataGrid
> | control
> | >| with the ID of grdPackages__ctl3_txtOrderQty'.  Most
> | of
> | >| the ID has been generated automatically by asp.Net.
> | The
> | >| name I gave it was 'txtOrderQty'.
> | >|
> | >| If I try to get the value of this text box once the
> | form
> | >| has been submitted, using:
> | >|
> | >|     Request.Form("grdPackages__ctl4_txtOrderQty")
> | >|
> | >| The value is a zero length string, yet I can see the
> | >| value is in fact a zero, i.e. "0".
> | >|
> | >| Interestingly if use Request.Form(2), the correct
> | value
> | >| is returned.
> | >|
> | >| Why is the correct value not returned?
> | >|
> | >| Is there an easier way of getting the values returned
> | >| from text boxes within a template on a DataGrid
> | control?
> | >|
> | >|
> | >| Many thanks, Mike.
> | >|
> | >
> | >.
> | >
> |

 
 
 

Can't get the value of a text box using it's ID

Post by Patrick C. Cole ( » Thu, 22 Aug 2002 22:02:49


Brad,

It certainly would.  As the saying goes, there is always more than one way
to skin a cat.

I wrote the previous snippet in a hurry.  Would not be surprised if it
could be optimized further  :>)

Patrick Cole
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
reserved.
--------------------






| Subject: Re: Can't get the value of a text box using it's ID
| Date: Tue, 20 Aug 2002 15:27:39 -0500
| Lines: 166
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: 206.50.253.82
| Path: cpmsftngxa10!tkmsftngp01!tkmsftngp13
| Xref: cpmsftngxa10
microsoft.public.dotnet.framework.aspnet.webcontrols:4756
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Wouldn't it be easier to code;
|
|     foreach(DataGridItem dgiTemp in dgTemp.Items)
|
| instead of;
|
|     foreach(DataGridItem dgiTemp in dgTemp.Controls[0].Controls)
|
| Then you could do away with the ItemType test.  Couldn't you?
|


| > Michael,
| >
| > I see no reason why you could not iternate through a list of
DataGridItems
| > for controls created in an ItemTemplate.  EditItemTemplate is a
different
| > story.  In fact, if you are not updating the DataGrid via an
| Update_Command
| > event, I would think that enumerating the DataGridItems would be the
only
| > solution.
| >
| > I did not see the other post you are referring to, but here is a sample
| > that will loop through the DataGrid, locate the TextBox, and return the
| > text of each TextBox.
| >
| > // Modify "DataGrid1" to locate your DataGrid control
| > DataGrid dgTemp = ((DataGrid)this.FindControl("DataGrid1"));
| >
| > // Loop through all DataGridItems in the DataGrid.
| > foreach(DataGridItem dgiTemp in dgTemp.Controls[0].Controls)
| > {
| > // Check for Item or AlternatingItem DataGridItems.  Most likely you
| > // will not have TextBoxes in the Header or Footer rows.
| > if(dgiTemp.ItemType.ToString() == "Item" || dgiTemp.ItemType.ToString()
| > == "AlternatingItem")
| > {
| > // "Test" is the ID of my TextBox.
| > TextBox tbTemp = ((TextBox)(dgiTemp.FindControl("Test")));
| > // Simply get the value and return it to the screen.
| > Response.Write(tbTemp.Text + "<br>");
| > }
| > }
| >
| > Patrick Cole
| > Microsoft Developer Support
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > You assume all risk for your use. ? 2002 Microsoft Corporation. All
rights
| > reserved.
| > --------------------
| > | Content-Class: urn:content-classes:message




| > | Subject: RE: Can't get the value of a text box using it's ID
| > | Date: Tue, 20 Aug 2002 03:56:39 -0700
| > | Lines: 94

| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="iso-8859-1"
| > | Content-Transfer-Encoding: quoted-printable
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| > | Thread-Index: AcJIOEMIT+k7zDRYQUCOdkoSf0V0tQ==
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | NNTP-Posting-Host: TKMSFTNGXA11 10.201.226.39
| > | Path: cpmsftngxa10!tkmsftngp01!cpmsftngxa07
| > | Xref: cpmsftngxa10
| > microsoft.public.dotnet.framework.aspnet.webcontrols:4737
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | Patrick,
| > | I am trying to get the value on a button onClick event,
| > | i.e. in this case 'btnPlaceOrder_Click'.
| > | I don't think the earlier suggestion by Mathew curry
| > | would work - There is no way to iterate through each text
| > | box automatically created by the Grid/Template control?
| > | To expand slightly on what I am trying to do - I am
| > | trying to iterate though all of the order quantity boxes
| > | to see which items have been ordered.  I will then go on
| > | to create the order for the items in a DB.
| > | Thanks, Mike.

| > | >-----Original Message-----
| > | >Michael,
| > | >
| > | >Where are you attempting to get the value of the
| > | textbox?  In what event on
| > | >PostBack?
| > | >
| > | >Patrick Cole
| > | >Microsoft Developer Support
| > | >
| > | >This posting is provided "AS IS" with no warranties, and
| > | confers no rights.
| > | >You assume all risk for your use. ? 2002 Microsoft
| > | Corporation. All rights
| > | >reserved.
| > | >--------------------
| > | >| Content-Class: urn:content-classes:message


| > | >| Subject: Can't get the value of a text box using it's
| > | ID
| > | >| Date: Thu, 15 Aug 2002 08:35:33 -0700
| > | >| Lines: 25
| > | >| Message-ID: <2cea01c24471$6507abf0

| > | >| MIME-Version: 1.0
| > | >| Content-Type: text/plain;
| > | >| charset="iso-8859-1"
| > | >| Content-Transfer-Encoding: 7bit
| > | >| X-Newsreader: Microsoft CDO for Windows 2000
| > | >| X-MimeOLE: Produced By Microsoft MimeOLE
| > | V5.50.4910.0300
| > | >| Thread-Index: AcJEcWUHr7LHrgV+QVSQHd1LqqKGJQ==
| > | >| Newsgroups:
| > | microsoft.public.dotnet.framework.aspnet.webcontrols
| > | >| Path: cpmsftngxa06
| > | >| Xref: cpmsftngxa06
| > | >microsoft.public.dotnet.framework.aspnet.webcontrols:4642
| > | >| NNTP-Posting-Host: TKMSFTNGXA08 10.201.226.36
| > | >| X-Tomcat-NG:
| > | microsoft.public.dotnet.framework.aspnet.webcontrols
| > | >|
| > | >| What am I doing wrong?
| > | >|
| > | >| I have a text box within template in a DataGrid
| > | control
| > | >| with the ID of grdPackages__ctl3_txtOrderQty'.  Most
| > | of
| > | >| the ID has been generated automatically by asp.Net.
| > | The
| > | >| name I gave it was 'txtOrderQty'.
| > | >|
| > | >| If I try to get the value of this text box once the
| > | form
| > | >| has been submitted, using:
| > | >|
| > | >|     Request.Form("grdPackages__ctl4_txtOrderQty")
| > | >|
| > | >| The value is a zero length string, yet I can see the
| > | >| value is in fact a zero, i.e. "0".
| > | >|
| > | >| Interestingly if use Request.Form(2), the correct
| > | value
| > | >| is returned.
| > | >|
| > | >| Why is the correct value not returned?
| > | >|
| > | >| Is there an easier way of getting the values returned
| > | >| from text boxes within a template on a DataGrid
| > | control?
| > | >|
| > | >|
| > | >| Many thanks, Mike.
| > | >|
| > | >
| > | >.
| > | >
| > |
| >
|
|
|

 
 
 

Can't get the value of a text box using it's ID

Post by Michael Owe » Thu, 22 Aug 2002 23:45:44


Thanks for your time and help gents.

I will give it a go and let you know how I get on.

:-)

Mike.

>-----Original Message-----
>Brad,

>It certainly would.  As the saying goes, there is always
more than one way
>to skin a cat.

>I wrote the previous snippet in a hurry.  Would not be
surprised if it
>could be optimized further  :>)

>Patrick Cole
>Microsoft Developer Support

>This posting is provided "AS IS" with no warranties, and
confers no rights.
>You assume all risk for your use. ? 2002 Microsoft

Corporation. All rights
>reserved.
>--------------------
>| Reply-To: "Brad Quinn" <brad_qu...@yahoo.com>
>| From: "Brad Quinn" <brad_qu...@yahoo.com>
>| References: <2cea01c24471$6507abf0

$39ef2ecf@TKMSFTNGXA08>
><oV5ngcVRCHA.2644@cpmsftngxa06>
><48ed01c24838$43086fb0$35ef2ecf@TKMSFTNGXA11>
><CRr6jzFSCHA.2668@cpmsftngxa10>
>| Subject: Re: Can't get the value of a text box using
it's ID
>| Date: Tue, 20 Aug 2002 15:27:39 -0500
>| Lines: 166
>| X-Priority: 3
>| X-MSMail-Priority: Normal
>| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
>| X-MimeOLE: Produced By Microsoft MimeOLE
V6.00.2600.0000
>| Message-ID: <#4knlfISCHA.1768@tkmsftngp13>
>| Newsgroups:

microsoft.public.dotnet.framework.aspnet.webcontrols
>| NNTP-Posting-Host: 206.50.253.82
>| Path: cpmsftngxa10!tkmsftngp01!tkmsftngp13
>| Xref: cpmsftngxa10
>microsoft.public.dotnet.framework.aspnet.webcontrols:4756
>| X-Tomcat-NG:

microsoft.public.dotnet.framework.aspnet.webcontrols

- Show quoted text -

>|
>| Wouldn't it be easier to code;
>|
>|     foreach(DataGridItem dgiTemp in dgTemp.Items)
>|
>| instead of;
>|
>|     foreach(DataGridItem dgiTemp in dgTemp.Controls
[0].Controls)
>|
>| Then you could do away with the ItemType test.  
Couldn't you?
>|
>| "Patrick C. Cole (MS)" <patc...@online.microsoft.com>
wrote in message
>| news:CRr6jzFSCHA.2668@cpmsftngxa10...
>| > Michael,
>| >
>| > I see no reason why you could not iternate through a
list of
>DataGridItems
>| > for controls created in an ItemTemplate.  

EditItemTemplate is a
>different
>| > story.  In fact, if you are not updating the
DataGrid via an
>| Update_Command
>| > event, I would think that enumerating the

DataGridItems would be the
>only
>| > solution.
>| >
>| > I did not see the other post you are referring to,

but here is a sample
>| > that will loop through the DataGrid, locate the

TextBox, and return the
>| > text of each TextBox.
>| >
>| > // Modify "DataGrid1" to locate your DataGrid control
>| > DataGrid dgTemp = ((DataGrid)this.FindControl
("DataGrid1"));
>| >
>| > // Loop through all DataGridItems in the DataGrid.
>| > foreach(DataGridItem dgiTemp in dgTemp.Controls
[0].Controls)
>| > {
>| > // Check for Item or AlternatingItem DataGridItems.  
Most likely you
>| > // will not have TextBoxes in the Header or Footer
rows.
>| > if(dgiTemp.ItemType.ToString() == "Item" ||

dgiTemp.ItemType.ToString()

- Show quoted text -

>| > == "AlternatingItem")
>| > {
>| > // "Test" is the ID of my TextBox.
>| > TextBox tbTemp = ((TextBox)(dgiTemp.FindControl
("Test")));
>| > // Simply get the value and return it to the screen.
>| > Response.Write(tbTemp.Text + "<br>");
>| > }
>| > }
>| >
>| > Patrick Cole
>| > Microsoft Developer Support
>| >
>| > This posting is provided "AS IS" with no warranties,
and confers no
>| rights.
>| > You assume all risk for your use. ? 2002 Microsoft
Corporation. All
>rights
>| > reserved.
>| > --------------------
>| > | Content-Class: urn:content-classes:message
>| > | From: "Michael Owen" <m...@mikeowen.co.uk>
>| > | Sender: "Michael Owen" <m...@mikeowen.co.uk>
>| > | References: <2cea01c24471$6507abf0

$39ef2ecf@TKMSFTNGXA08>
>| > <oV5ngcVRCHA.2644@cpmsftngxa06>
>| > | Subject: RE: Can't get the value of a text box
using it's ID
>| > | Date: Tue, 20 Aug 2002 03:56:39 -0700
>| > | Lines: 94
>| > | Message-ID: <48ed01c24838$43086fb0

$35ef2ecf@TKMSFTNGXA11>
>| > | MIME-Version: 1.0
>| > | Content-Type: text/plain;
>| > | charset="iso-8859-1"
>| > | Content-Transfer-Encoding: quoted-printable
>| > | X-Newsreader: Microsoft CDO for Windows 2000
>| > | X-MimeOLE: Produced By Microsoft MimeOLE
V5.50.4910.0300
>| > | Thread-Index: AcJIOEMIT+k7zDRYQUCOdkoSf0V0tQ==
>| > | Newsgroups:

microsoft.public.dotnet.framework.aspnet.webcontrols
>| > | NNTP-Posting-Host: TKMSFTNGXA11 10.201.226.39
>| > | Path: cpmsftngxa10!tkmsftngp01!cpmsftngxa07
>| > | Xref: cpmsftngxa10
>| >

microsoft.public.dotnet.framework.aspnet.webcontrols:4737
>| > | X-Tomcat-NG:

microsoft.public.dotnet.framework.aspnet.webcontrols

- Show quoted text -

>| > |
>| > | Patrick,
>| > | I am trying to get the value on a button onClick
event,
>| > | i.e. in this case 'btnPlaceOrder_Click'.
>| > | I don't think the earlier suggestion by Mathew
curry
>| > | would work - There is no way to iterate through
each text
>| > | box automatically created by the Grid/Template
control?
>| > | To expand slightly on what I am trying to do - I am
>| > | trying to iterate though all of the order quantity
boxes
>| > | to see which items have been ordered.  I will then
go on
>| > | to create the order for the items in a DB.
>| > | Thanks, Mike.
>| > | >-----Original Message-----
>| > | >Michael,
>| > | >
>| > | >Where are you attempting to get the value of the
>| > | textbox?  In what event on
>| > | >PostBack?
>| > | >
>| > | >Patrick Cole
>| > | >Microsoft Developer Support
>| > | >
>| > | >This posting is provided "AS IS" with no
warranties, and
>| > | confers no rights.
>| > | >You assume all risk for your use. ? 2002 Microsoft
>| > | Corporation. All rights
>| > | >reserved.
>| > | >--------------------
>| > | >| Content-Class: urn:content-classes:message
>| > | >| From: "Michael Owen" <m...@mikeowen.co.uk>
>| > | >| Sender: "Michael Owen" <m...@mikeowen.co.uk>
>| > | >| Subject: Can't get the value of a text box
using it's
>| > | ID
>| > | >| Date: Thu, 15 Aug 2002 08:35:33 -0700
>| > | >| Lines: 25
>| > | >| Message-ID: <2cea01c24471$6507abf0
>| > | $39ef2ecf@TKMSFTNGXA08>
>| > | >| MIME-Version: 1.0
>| > | >| Content-Type: text/plain;
>| > | >| charset="iso-8859-1"
>| > | >| Content-Transfer-Encoding: 7bit
>| > | >| X-Newsreader: Microsoft CDO for Windows 2000
>| > | >| X-MimeOLE: Produced By Microsoft MimeOLE
>| > | V5.50.4910.0300
>| > | >| Thread-Index: AcJEcWUHr7LHrgV+QVSQHd1LqqKGJQ==
>| > | >| Newsgroups:
>| > |

microsoft.public.dotnet.framework.aspnet.webcontrols
>| > | >| Path: cpmsftngxa06
>| > | >| Xref: cpmsftngxa06
>| > |
>microsoft.public.dotnet.framework.aspnet.webcontrols:4642
>| > | >| NNTP-Posting-Host: TKMSFTNGXA08 10.201.226.36
>| > | >| X-Tomcat-NG:
>| > |

microsoft.public.dotnet.framework.aspnet.webcontrols

- Show quoted text -

>| > | >|
>| > | >| What am I doing wrong?
>| > | >|
>| > | >| I have a text box within template in a DataGrid
>| > | control
>| > | >| with the ID of grdPackages__ctl3_txtOrderQty'.  
Most
>| > | of
>| > | >| the ID has been generated automatically by
asp.Net.
>| > | The
>| > | >| name I gave it was 'txtOrderQty'.
>| > | >|
>| > | >| If I try to get the value of this text box once
the
>| > | form
>| > | >| has been submitted, using:
>| > | >|
>| > | >|     Request.Form

("grdPackages__ctl4_txtOrderQty")

- Show quoted text -

>| > | >|
>| > | >| The value is a zero length string, yet I can
see the
>| > | >| value is in fact a zero, i.e. "0".
>| > | >|
>| > | >| Interestingly if use Request.Form(2), the
correct
>| > | value
>| > | >| is returned.
>| > | >|
>| > | >| Why is the correct value not returned?
>| > | >|
>| > | >| Is there an easier way of getting the values
returned
>| > | >| from text boxes within a template on a DataGrid
>| > | control?
>| > | >|
>| > | >|
>| > | >| Many thanks, Mike.
>| > | >|
>| > | >
>| > | >.
>| > | >
>| > |
>| >
>|
>|
>|

>.

 
 
 

Can't get the value of a text box using it's ID

Post by David Kin » Fri, 30 Aug 2002 06:10:24


Here's a further twist on this issue:  1) First off, how would I add a checkbox to a DataGrid that is added at runtime?  2)  How would I FindControl the new DataGrid added at runtime?

e.g.

if some event happens
    create a new datagrid
foreach row's checkbox selected in the new datagrid
    get the fieldvalue of the checkbox

Thanks,

David King


> Michael,

> I see no reason why you could not iternate through a list of DataGridItems
> for controls created in an ItemTemplate.  EditItemTemplate is a different
> story.  In fact, if you are not updating the DataGrid via an Update_Command
> event, I would think that enumerating the DataGridItems would be the only
> solution.

> I did not see the other post you are referring to, but here is a sample
> that will loop through the DataGrid, locate the TextBox, and return the
> text of each TextBox.

> // Modify "DataGrid1" to locate your DataGrid control
> DataGrid dgTemp = ((DataGrid)this.FindControl("DataGrid1"));

> // Loop through all DataGridItems in the DataGrid.
> foreach(DataGridItem dgiTemp in dgTemp.Controls[0].Controls)
> {
> // Check for Item or AlternatingItem DataGridItems.  Most likely you
> // will not have TextBoxes in the Header or Footer rows.
> if(dgiTemp.ItemType.ToString() == "Item" || dgiTemp.ItemType.ToString()
> == "AlternatingItem")
> {
> // "Test" is the ID of my TextBox.
> TextBox tbTemp = ((TextBox)(dgiTemp.FindControl("Test")));
> // Simply get the value and return it to the screen.
> Response.Write(tbTemp.Text + "<br>");
> }
> }

> Patrick Cole
> Microsoft Developer Support

> This posting is provided "AS IS" with no warranties, and confers no rights.
> You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
> reserved.
> --------------------
> | Content-Class: urn:content-classes:message




> | Subject: RE: Can't get the value of a text box using it's ID
> | Date: Tue, 20 Aug 2002 03:56:39 -0700
> | Lines: 94

> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | charset="iso-8859-1"
> | Content-Transfer-Encoding: quoted-printable
> | X-Newsreader: Microsoft CDO for Windows 2000
> | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
> | Thread-Index: AcJIOEMIT+k7zDRYQUCOdkoSf0V0tQ==
> | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
> | NNTP-Posting-Host: TKMSFTNGXA11 10.201.226.39
> | Path: cpmsftngxa10!tkmsftngp01!cpmsftngxa07
> | Xref: cpmsftngxa10
> microsoft.public.dotnet.framework.aspnet.webcontrols:4737
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
> |
> | Patrick,
> | I am trying to get the value on a button onClick event,
> | i.e. in this case 'btnPlaceOrder_Click'.
> | I don't think the earlier suggestion by Mathew curry
> | would work - There is no way to iterate through each text
> | box automatically created by the Grid/Template control?
> | To expand slightly on what I am trying to do - I am
> | trying to iterate though all of the order quantity boxes
> | to see which items have been ordered.  I will then go on
> | to create the order for the items in a DB.
> | Thanks, Mike.
> | >-----Original Message-----
> | >Michael,
> | >
> | >Where are you attempting to get the value of the
> | textbox?  In what event on
> | >PostBack?
> | >
> | >Patrick Cole
> | >Microsoft Developer Support
> | >
> | >This posting is provided "AS IS" with no warranties, and
> | confers no rights.
> | >You assume all risk for your use. ? 2002 Microsoft
> | Corporation. All rights
> | >reserved.
> | >--------------------
> | >| Content-Class: urn:content-classes:message


> | >| Subject: Can't get the value of a text box using it's
> | ID
> | >| Date: Thu, 15 Aug 2002 08:35:33 -0700
> | >| Lines: 25
> | >| Message-ID: <2cea01c24471$6507abf0

> | >| MIME-Version: 1.0
> | >| Content-Type: text/plain;
> | >| charset="iso-8859-1"
> | >| Content-Transfer-Encoding: 7bit
> | >| X-Newsreader: Microsoft CDO for Windows 2000
> | >| X-MimeOLE: Produced By Microsoft MimeOLE
> | V5.50.4910.0300
> | >| Thread-Index: AcJEcWUHr7LHrgV+QVSQHd1LqqKGJQ==
> | >| Newsgroups:
> | microsoft.public.dotnet.framework.aspnet.webcontrols
> | >| Path: cpmsftngxa06
> | >| Xref: cpmsftngxa06
> | >microsoft.public.dotnet.framework.aspnet.webcontrols:4642
> | >| NNTP-Posting-Host: TKMSFTNGXA08 10.201.226.36
> | >| X-Tomcat-NG:
> | microsoft.public.dotnet.framework.aspnet.webcontrols
> | >|
> | >| What am I doing wrong?
> | >|
> | >| I have a text box within template in a DataGrid
> | control
> | >| with the ID of grdPackages__ctl3_txtOrderQty'.  Most
> | of
> | >| the ID has been generated automatically by asp.Net.  
> | The
> | >| name I gave it was 'txtOrderQty'.
> | >|
> | >| If I try to get the value of this text box once the
> | form
> | >| has been submitted, using:
> | >|
> | >|     Request.Form("grdPackages__ctl4_txtOrderQty")
> | >|
> | >| The value is a zero length string, yet I can see the
> | >| value is in fact a zero, i.e. "0".
> | >|
> | >| Interestingly if use Request.Form(2), the correct
> | value
> | >| is returned.
> | >|
> | >| Why is the correct value not returned?
> | >|
> | >| Is there an easier way of getting the values returned
> | >| from text boxes within a template on a DataGrid
> | control?
> | >|
> | >|
> | >| Many thanks, Mike.
> | >|
> | >
> | >.
> | >
> |

 
 
 

Can't get the value of a text box using it's ID

Post by Mike Owe » Tue, 24 Sep 2002 18:59:41


I took my time getting back to it.... as usual other
things overtake the issue, but have now successfully
tried, and am using,  the above.

All - Thanks for your help!

Mike.

>-----Original Message-----
>Brad,

>It certainly would.  As the saying goes, there is always
more than one way
>to skin a cat.

>I wrote the previous snippet in a hurry.  Would not be
surprised if it
>could be optimized further  :>)

>Patrick Cole
>Microsoft Developer Support

>This posting is provided "AS IS" with no warranties, and
confers no rights.
>You assume all risk for your use. ? 2002 Microsoft

Corporation. All rights
>reserved.
>--------------------
>| Reply-To: "Brad Quinn" <brad_qu...@yahoo.com>
>| From: "Brad Quinn" <brad_qu...@yahoo.com>
>| References: <2cea01c24471$6507abf0

$39ef2ecf@TKMSFTNGXA08>
><oV5ngcVRCHA.2644@cpmsftngxa06>
><48ed01c24838$43086fb0$35ef2ecf@TKMSFTNGXA11>
><CRr6jzFSCHA.2668@cpmsftngxa10>
>| Subject: Re: Can't get the value of a text box using
it's ID
>| Date: Tue, 20 Aug 2002 15:27:39 -0500
>| Lines: 166
>| X-Priority: 3
>| X-MSMail-Priority: Normal
>| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
>| X-MimeOLE: Produced By Microsoft MimeOLE
V6.00.2600.0000
>| Message-ID: <#4knlfISCHA.1768@tkmsftngp13>
>| Newsgroups:

microsoft.public.dotnet.framework.aspnet.webcontrols
>| NNTP-Posting-Host: 206.50.253.82
>| Path: cpmsftngxa10!tkmsftngp01!tkmsftngp13
>| Xref: cpmsftngxa10
>microsoft.public.dotnet.framework.aspnet.webcontrols:4756
>| X-Tomcat-NG:

microsoft.public.dotnet.framework.aspnet.webcontrols

- Show quoted text -

>|
>| Wouldn't it be easier to code;
>|
>|     foreach(DataGridItem dgiTemp in dgTemp.Items)
>|
>| instead of;
>|
>|     foreach(DataGridItem dgiTemp in dgTemp.Controls
[0].Controls)
>|
>| Then you could do away with the ItemType test.  
Couldn't you?
>|
>| "Patrick C. Cole (MS)" <patc...@online.microsoft.com>
wrote in message
>| news:CRr6jzFSCHA.2668@cpmsftngxa10...
>| > Michael,
>| >
>| > I see no reason why you could not iternate through a
list of
>DataGridItems
>| > for controls created in an ItemTemplate.  

EditItemTemplate is a
>different
>| > story.  In fact, if you are not updating the
DataGrid via an
>| Update_Command
>| > event, I would think that enumerating the

DataGridItems would be the
>only
>| > solution.
>| >
>| > I did not see the other post you are referring to,

but here is a sample
>| > that will loop through the DataGrid, locate the

TextBox, and return the
>| > text of each TextBox.
>| >
>| > // Modify "DataGrid1" to locate your DataGrid control
>| > DataGrid dgTemp = ((DataGrid)this.FindControl
("DataGrid1"));
>| >
>| > // Loop through all DataGridItems in the DataGrid.
>| > foreach(DataGridItem dgiTemp in dgTemp.Controls
[0].Controls)
>| > {
>| > // Check for Item or AlternatingItem DataGridItems.  
Most likely you
>| > // will not have TextBoxes in the Header or Footer
rows.
>| > if(dgiTemp.ItemType.ToString() == "Item" ||

dgiTemp.ItemType.ToString()

- Show quoted text -

>| > == "AlternatingItem")
>| > {
>| > // "Test" is the ID of my TextBox.
>| > TextBox tbTemp = ((TextBox)(dgiTemp.FindControl
("Test")));
>| > // Simply get the value and return it to the screen.
>| > Response.Write(tbTemp.Text + "<br>");
>| > }
>| > }
>| >
>| > Patrick Cole
>| > Microsoft Developer Support
>| >
>| > This posting is provided "AS IS" with no warranties,
and confers no
>| rights.
>| > You assume all risk for your use. ? 2002 Microsoft
Corporation. All
>rights
>| > reserved.
>| > --------------------
>| > | Content-Class: urn:content-classes:message
>| > | From: "Michael Owen" <m...@mikeowen.co.uk>
>| > | Sender: "Michael Owen" <m...@mikeowen.co.uk>
>| > | References: <2cea01c24471$6507abf0

$39ef2ecf@TKMSFTNGXA08>
>| > <oV5ngcVRCHA.2644@cpmsftngxa06>
>| > | Subject: RE: Can't get the value of a text box
using it's ID
>| > | Date: Tue, 20 Aug 2002 03:56:39 -0700
>| > | Lines: 94
>| > | Message-ID: <48ed01c24838$43086fb0

$35ef2ecf@TKMSFTNGXA11>
>| > | MIME-Version: 1.0
>| > | Content-Type: text/plain;
>| > | charset="iso-8859-1"
>| > | Content-Transfer-Encoding: quoted-printable
>| > | X-Newsreader: Microsoft CDO for Windows 2000
>| > | X-MimeOLE: Produced By Microsoft MimeOLE
V5.50.4910.0300
>| > | Thread-Index: AcJIOEMIT+k7zDRYQUCOdkoSf0V0tQ==
>| > | Newsgroups:

microsoft.public.dotnet.framework.aspnet.webcontrols
>| > | NNTP-Posting-Host: TKMSFTNGXA11 10.201.226.39
>| > | Path: cpmsftngxa10!tkmsftngp01!cpmsftngxa07
>| > | Xref: cpmsftngxa10
>| >

microsoft.public.dotnet.framework.aspnet.webcontrols:4737
>| > | X-Tomcat-NG:

microsoft.public.dotnet.framework.aspnet.webcontrols

- Show quoted text -

>| > |
>| > | Patrick,
>| > | I am trying to get the value on a button onClick
event,
>| > | i.e. in this case 'btnPlaceOrder_Click'.
>| > | I don't think the earlier suggestion by Mathew
curry
>| > | would work - There is no way to iterate through
each text
>| > | box automatically created by the Grid/Template
control?
>| > | To expand slightly on what I am trying to do - I am
>| > | trying to iterate though all of the order quantity
boxes
>| > | to see which items have been ordered.  I will then
go on
>| > | to create the order for the items in a DB.
>| > | Thanks, Mike.
>| > | >-----Original Message-----
>| > | >Michael,
>| > | >
>| > | >Where are you attempting to get the value of the
>| > | textbox?  In what event on
>| > | >PostBack?
>| > | >
>| > | >Patrick Cole
>| > | >Microsoft Developer Support
>| > | >
>| > | >This posting is provided "AS IS" with no
warranties, and
>| > | confers no rights.
>| > | >You assume all risk for your use. ? 2002 Microsoft
>| > | Corporation. All rights
>| > | >reserved.
>| > | >--------------------
>| > | >| Content-Class: urn:content-classes:message
>| > | >| From: "Michael Owen" <m...@mikeowen.co.uk>
>| > | >| Sender: "Michael Owen" <m...@mikeowen.co.uk>
>| > | >| Subject: Can't get the value of a text box
using it's
>| > | ID
>| > | >| Date: Thu, 15 Aug 2002 08:35:33 -0700
>| > | >| Lines: 25
>| > | >| Message-ID: <2cea01c24471$6507abf0
>| > | $39ef2ecf@TKMSFTNGXA08>
>| > | >| MIME-Version: 1.0
>| > | >| Content-Type: text/plain;
>| > | >| charset="iso-8859-1"
>| > | >| Content-Transfer-Encoding: 7bit
>| > | >| X-Newsreader: Microsoft CDO for Windows 2000
>| > | >| X-MimeOLE: Produced By Microsoft MimeOLE
>| > | V5.50.4910.0300
>| > | >| Thread-Index: AcJEcWUHr7LHrgV+QVSQHd1LqqKGJQ==
>| > | >| Newsgroups:
>| > |

microsoft.public.dotnet.framework.aspnet.webcontrols
>| > | >| Path: cpmsftngxa06
>| > | >| Xref: cpmsftngxa06
>| > |
>microsoft.public.dotnet.framework.aspnet.webcontrols:4642
>| > | >| NNTP-Posting-Host: TKMSFTNGXA08 10.201.226.36
>| > | >| X-Tomcat-NG:
>| > |

microsoft.public.dotnet.framework.aspnet.webcontrols

- Show quoted text -

>| > | >|
>| > | >| What am I doing wrong?
>| > | >|
>| > | >| I have a text box within template in a DataGrid
>| > | control
>| > | >| with the ID of grdPackages__ctl3_txtOrderQty'.  
Most
>| > | of
>| > | >| the ID has been generated automatically by
asp.Net.
>| > | The
>| > | >| name I gave it was 'txtOrderQty'.
>| > | >|
>| > | >| If I try to get the value of this text box once
the
>| > | form
>| > | >| has been submitted, using:
>| > | >|
>| > | >|     Request.Form

("grdPackages__ctl4_txtOrderQty")

- Show quoted text -

>| > | >|
>| > | >| The value is a zero length string, yet I can
see the
>| > | >| value is in fact a zero, i.e. "0".
>| > | >|
>| > | >| Interestingly if use Request.Form(2), the
correct
>| > | value
>| > | >| is returned.
>| > | >|
>| > | >| Why is the correct value not returned?
>| > | >|
>| > | >| Is there an easier way of getting the values
returned
>| > | >| from text boxes within a template on a DataGrid
>| > | control?
>| > | >|
>| > | >|
>| > | >| Many thanks, Mike.
>| > | >|
>| > | >
>| > | >.
>| > | >
>| > |
>| >
>|
>|
>|

>.

 
 
 

1. Getting a unque ID from the 'Identity' object.

When using Windows authentication....does anyone know if its possible to get
a unique ID (like the user's GUID) from ASP.NET?

The closest thing I can see is the 'Name' property of the User.Identity
object, but I'd like something more unique than that (the user can be
deleted and a new user created with the same name) to key objects in an
external database.

2. Serial freeze

3. Client found response content type of 'text/plain', but expected 'text/xml'

4. Process View/Diagram

5. XML Schema Validation : Invalid 'id' attribute value

6. Good DNS book?

7. Getting a child control from a group box using it's name

8. Q: computing exponential

9. text box, drop down listing box doesn't show in browser

10. New menu ID'd values being assigned value 0?

11. Multiline text box doesn't fire text changed

12. The id 'ctrl1' is already used by another control