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

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

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!
Nov 19 '05 #1
2 1568
You can setup different sets of validator controls using the ValidationGroup
property -- this way you can have different validators for InsertMode and
UpdateMode.

http://beta.asp.net/QUICKSTART/aspne...lidationgroups

-Brock
DevelopMentor
http://staff.develop.com/ballen
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!


Nov 19 '05 #2
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!!
Nov 19 '05 #3

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

Similar topics

3
by: misiek | last post by:
Hi all. I have following problem: 1. In my web page I have a GridView control, which does not have a DataSourceId set in designer. 2. When user presses Start button then I create...
0
by: j-in-uk | last post by:
Hi, I am using the gridView control at first the EmptyInsert command is executed from the EmptyDataTemplate but when a user clicks Edit after the 1st insert, for some reason it detects the...
3
by: Joey | last post by:
asp.net 2.0 VS2005 C# In my web app I added a gridview and then manually configured boundcolumns, for an in-session dataset to act as a datasource. Then I added an Edit commandfield. When I...
0
by: yukijocelyn | last post by:
I have experienced a problem here while doing a form for accessing datadbase using MS Access. I'm using the AccessDataSource control, and using Gridview to pull the data from the database. I am able...
2
by: David Ching | last post by:
I am not getting any response to my previous question on reusing a DetailsView to insert and edit the selected row in a GridView. So I'll ask an even more basic question. Newbie alert! ;) When...
1
by: Paulo | last post by:
Hi, I have a aspx with a a FormView on left wich opens insert template as default containing all the TextsBox, Combos, etc, and on right a GridView listing the stored itens (ID column key)... When...
2
by: shapper | last post by:
Hello, I am working with a ListView but I suppose that with a GridView might be the same. Instead of having an Insert Button on each GridView row I would like to have only one Insert button,...
11
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know...
12
by: dorandoran | last post by:
I followed this link to add new record from gridview. So far it's good but I need to modify the last piece to edit the record that I will supply the record id. ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.