ASP.NET 2.0 Whidbey, Customizing the Edit/Insert mode for GridView

G

Guest

Hopefully someone else has come across this issue.

What I have is a SQL Server 2000 back-end. I've created a simple webform
which has both Gridview and DataList controls on it populated with a
SqlDataSource. Okay, simple enough, that all works fine. I have also
enabled inserting and editing on these controls. This is a very cool feature
of 2.0 and it works quite well. Functionally I am able to do everything such
as inserting and editing, so I know that everything is setup correctly. What
I want to do now is validation...

When a user uses the control, they click on "New", the control is changed
into insert mode, and empty text boxes are presented. The fill in what they
want and click on insert. But how can I implement validation? There is
nothing I can find to prevent a user from putting text into an integer field
and trying to insert it. Of course if they do that a SQL exception will be
thrown. I know how to handle the exception and give an error, but I feel
that is too late in the process. I would like to do regular validation just
like on a simple web form. Is there a way to edit the insert mode of these
controls? Both visually and programmatically?

Also, let's say I want to replace a textbox with a dropdownlist in the
insert mode, can this be done? Surely someone else has thought of this, or
am I just expecting too much out of these controls?

Thanks in advance! If you need anything clarified or some code please let
me know!
 
G

Guest

Wonderful, but I'm still not quite there. I have used the validation groups
and am familiar with how they work and I'm sure I can make them do what I
need to. I still have the problem of editing these modes. How can I step
into the Edit/Insert modes of these controls so I can edit them. Similar to
how you can convert the Login control to a template and then make any changes
you want. That way I can add the validation controls and assign them to a UI
control.

I must be missing something??? Hopefully I am making sense of what I am
trying to do.

Thanks for the quick response!!
 

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,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top