Hey all,
I'm trying to implement validation in my asp.net datagrid. For example, if a
user enters in a Customer ID I want it to check a different data table to see
if the customer exists.
I'm assuming I'll have to use template columns to add the custom validation
control next to each textbox. Please correct me if I'm wrong because i'm
having a challenging time with template columns.
Here's my question: I've noticed an issue between using template columns and
the regular bound columns. The way the textbox is accessed thru code:
Bound Column access to textbox
Cells(2).Controls(0)
Template Column access to textbox
Cells(2).Controls(1)
Why is there a difference?
thanks,
rodchar 6 1397
Hi rodchar:
It all depends on what HTML these controls generate. I've always shied
away from indexing into the Controls array, because I imagine at some
point in the future the functionality might change and the controls
won't be at that position anymore (or I might decide to change the
layout, too). I've been using the Control.FincControl method on
DataGrid item to locate any server side controls I want to inspect ro
change from code.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Thu, 14 Oct 2004 08:43:03 -0700, "rodchar"
<ro*****@discussions.microsoft.com> wrote: Hey all,
I'm trying to implement validation in my asp.net datagrid. For example, if a user enters in a Customer ID I want it to check a different data table to see if the customer exists.
I'm assuming I'll have to use template columns to add the custom validation control next to each textbox. Please correct me if I'm wrong because i'm having a challenging time with template columns.
Here's my question: I've noticed an issue between using template columns and the regular bound columns. The way the textbox is accessed thru code:
Bound Column access to textbox Cells(2).Controls(0)
Template Column access to textbox Cells(2).Controls(1)
Why is there a difference?
thanks, rodchar
rodchar, ditto: you'll make yourself crazy if you don't use findcontrol.
"Scott Allen" wrote: Hi rodchar:
It all depends on what HTML these controls generate. I've always shied away from indexing into the Controls array, because I imagine at some point in the future the functionality might change and the controls won't be at that position anymore (or I might decide to change the layout, too). I've been using the Control.FincControl method on DataGrid item to locate any server side controls I want to inspect ro change from code.
-- Scott http://www.OdeToCode.com/blogs/scott/
On Thu, 14 Oct 2004 08:43:03 -0700, "rodchar" <ro*****@discussions.microsoft.com> wrote:
Hey all,
I'm trying to implement validation in my asp.net datagrid. For example, if a user enters in a Customer ID I want it to check a different data table to see if the customer exists.
I'm assuming I'll have to use template columns to add the custom validation control next to each textbox. Please correct me if I'm wrong because i'm having a challenging time with template columns.
Here's my question: I've noticed an issue between using template columns and the regular bound columns. The way the textbox is accessed thru code:
Bound Column access to textbox Cells(2).Controls(0)
Template Column access to textbox Cells(2).Controls(1)
Why is there a difference?
thanks, rodchar
thanks for the tips everyone. i really appreciate it.
"rodchar" wrote: Hey all,
I'm trying to implement validation in my asp.net datagrid. For example, if a user enters in a Customer ID I want it to check a different data table to see if the customer exists.
I'm assuming I'll have to use template columns to add the custom validation control next to each textbox. Please correct me if I'm wrong because i'm having a challenging time with template columns.
Here's my question: I've noticed an issue between using template columns and the regular bound columns. The way the textbox is accessed thru code:
Bound Column access to textbox Cells(2).Controls(0)
Template Column access to textbox Cells(2).Controls(1)
Why is there a difference?
thanks, rodchar
what would be the textbox id if the columns are auto-generated?
"Scott Allen" wrote: Hi rodchar:
It all depends on what HTML these controls generate. I've always shied away from indexing into the Controls array, because I imagine at some point in the future the functionality might change and the controls won't be at that position anymore (or I might decide to change the layout, too). I've been using the Control.FincControl method on DataGrid item to locate any server side controls I want to inspect ro change from code.
-- Scott http://www.OdeToCode.com/blogs/scott/
On Thu, 14 Oct 2004 08:43:03 -0700, "rodchar" <ro*****@discussions.microsoft.com> wrote:
Hey all,
I'm trying to implement validation in my asp.net datagrid. For example, if a user enters in a Customer ID I want it to check a different data table to see if the customer exists.
I'm assuming I'll have to use template columns to add the custom validation control next to each textbox. Please correct me if I'm wrong because i'm having a challenging time with template columns.
Here's my question: I've noticed an issue between using template columns and the regular bound columns. The way the textbox is accessed thru code:
Bound Column access to textbox Cells(2).Controls(0)
Template Column access to textbox Cells(2).Controls(1)
Why is there a difference?
thanks, rodchar
If you call find control on the DataGridItem (the row), the TextBox
ID will be the same as the ID the textbox has in the markup.
I have an article that explains this in detail: http://odetocode.com/Articles/116.aspx
HTH,
--
Scott http://www.OdeToCode.com/
On Fri, 15 Oct 2004 12:29:09 -0700, "rodchar"
<ro*****@discussions.microsoft.com> wrote: what would be the textbox id if the columns are auto-generated?
"Scott Allen" wrote:
Hi rodchar:
It all depends on what HTML these controls generate. I've always shied away from indexing into the Controls array, because I imagine at some point in the future the functionality might change and the controls won't be at that position anymore (or I might decide to change the layout, too). I've been using the Control.FincControl method on DataGrid item to locate any server side controls I want to inspect ro change from code.
-- Scott http://www.OdeToCode.com/blogs/scott/
On Thu, 14 Oct 2004 08:43:03 -0700, "rodchar" <ro*****@discussions.microsoft.com> wrote:
>Hey all, > >I'm trying to implement validation in my asp.net datagrid. For example, if a >user enters in a Customer ID I want it to check a different data table to see >if the customer exists. > >I'm assuming I'll have to use template columns to add the custom validation >control next to each textbox. Please correct me if I'm wrong because i'm >having a challenging time with template columns. > >Here's my question: I've noticed an issue between using template columns and >the regular bound columns. The way the textbox is accessed thru code: > >Bound Column access to textbox >Cells(2).Controls(0) > >Template Column access to textbox >Cells(2).Controls(1) > >Why is there a difference? > >thanks, >rodchar
awesome, thank you so much.
"Scott Allen" wrote: If you call find control on the DataGridItem (the row), the TextBox ID will be the same as the ID the textbox has in the markup.
I have an article that explains this in detail: http://odetocode.com/Articles/116.aspx
HTH, -- Scott http://www.OdeToCode.com/
On Fri, 15 Oct 2004 12:29:09 -0700, "rodchar" <ro*****@discussions.microsoft.com> wrote:
what would be the textbox id if the columns are auto-generated?
"Scott Allen" wrote:
Hi rodchar:
It all depends on what HTML these controls generate. I've always shied away from indexing into the Controls array, because I imagine at some point in the future the functionality might change and the controls won't be at that position anymore (or I might decide to change the layout, too). I've been using the Control.FincControl method on DataGrid item to locate any server side controls I want to inspect ro change from code.
-- Scott http://www.OdeToCode.com/blogs/scott/
On Thu, 14 Oct 2004 08:43:03 -0700, "rodchar" <ro*****@discussions.microsoft.com> wrote:
>Hey all, > >I'm trying to implement validation in my asp.net datagrid. For example, if a >user enters in a Customer ID I want it to check a different data table to see >if the customer exists. > >I'm assuming I'll have to use template columns to add the custom validation >control next to each textbox. Please correct me if I'm wrong because i'm >having a challenging time with template columns. > >Here's my question: I've noticed an issue between using template columns and >the regular bound columns. The way the textbox is accessed thru code: > >Bound Column access to textbox >Cells(2).Controls(0) > >Template Column access to textbox >Cells(2).Controls(1) > >Why is there a difference? > >thanks, >rodchar
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ED M. |
last post by:
Hello all...I'm new to the board. I have a problem that I hope someone here
might be able to solve for me.
I am doing some clientside validation using Javascript. The text I am
testing is...
|
by: GregM |
last post by:
I have a read only datagrid that is designed to coordinate itself with
textboxes. When the user clicks on a row in the datagrid, detailed
data for that row is displayed for editing in the...
|
by: Stephan Bour |
last post by:
Hi,
I need to validate a text box in a datagrid nested inside a datalist. All I
need is to validate that any text is entered in the textbox. However, a
requiredfieldvalidator would not do because...
|
by: Ben |
last post by:
Hi, I have a page with a datagrid that you have to scroll to see. I'm using
the StrengthControls SmartScroller as recommended to maintain my scroll
position.
Anyway, inside the datagrid I have...
|
by: rodchar |
last post by:
Hey all,
I've got an asp.net page that has a textbox on it. The textbox has a
requiredfieldvalidation associated with it.
I've also got a datagrid with the edit,update,cancel links on it. When...
|
by: Chris |
last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a
datagrid I utilize the footer to create the 'add' row. The only issue is that
I have it sharing the 'UpDate_Command' and...
|
by: siaj |
last post by:
Hello All,
If some one has faced a similar issue..
My datagrid Update command is not getting fired in fact it seems that the no
event fires on clicking the update link. Although the cancel and the...
|
by: David Colliver |
last post by:
Hi all,
I am having a slight problem that hopefully, someone can help me fix.
I have a form on a page. Many items on the form have validation controls
attached.
Also on this form are...
|
by: Kris |
last post by:
Hi,
I have a DataGrid where in each row has couple of text boxes and an
update button. Each row is dynamically generated as the number of rows
are not known ahead of time. When the user clicks the...
|
by: Tina |
last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing
validation elsewhere on the page. I want to specify that these buttons
should not cause validation but they have no design...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
| |