Datagrid validation

G

Guest

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
 
S

Scott Allen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top