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!
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!