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

Datagrid validation

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
Nov 18 '05 #1
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


Nov 18 '05 #2
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


Nov 18 '05 #3
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

Nov 18 '05 #4
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


Nov 18 '05 #5
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



Nov 18 '05 #6
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


Nov 18 '05 #7

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

Similar topics

0
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...
1
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...
1
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...
3
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...
2
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...
5
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...
4
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...
4
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...
1
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...
5
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...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...
0
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...
0
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...

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.