Welcome Guest Search | Active Topics | Sign In | Register

GridView Validation Options
Vince
Posted: Friday, February 12, 2010 3:09:47 AM
Rank: Newbie
Groups: Member

Joined: 2/12/2010
Posts: 1
I am very new to EO. Recently downloaded the controls. How do you validate input in the Grid? In the regulal gridview control, I use the validation controls. Is there an equivilent?
eo_support
Posted: Friday, February 12, 2010 9:15:12 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

EO.Grid is much more powerful but it is also a bit more complex than the standard GridView. Specifically it allows you to make multiple changes before your page is posted back to the server (for example, you can modify multiple cells and then post back all the changes back to the server with one button click). Most standard validator controls work with a single piece of input data. For example, RequiredValidator verifies whether a single input field is empty. This does not work with EO.Grid because potentially multiple places need to be validated.

However you can use a CustomValidator to validate all the data in the Grid at once. To do so simply handle your CustomValidator's Validate event to check all the Grid cells you want to check. You can also provide a client side JavaScript validation function to check all cell values on the client side. You will need to use the Grid’s client side JavaScript API to access the cell data if you choose to do so:

http://doc.essentialobjects.com/library/1/clientapi_howto.aspx

If you wish to validate on each cell right after user edited the cell, you will need to handle the Grid's ClientSideAfterEdit event. Here is a working example demonstrating how to do this:

http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\_i23

You can take a look of the sample source code to see how it works.

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
David
Posted: Saturday, March 20, 2010 3:50:23 PM
Rank: Advanced Member
Groups: Member

Joined: 10/21/2009
Posts: 39
Is there any sample code to look at for doing server side validation. I need to handle the case where the client turns off Javascript on their browser by doing server validation as well as client validation.
eo_support
Posted: Monday, March 22, 2010 9:08:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The best option for you is to detect whether JavaScript is enabled and then display a warning message asking user to turn on JavaScript when it is disabled. Almost all ASP.NET server events will stop working if script is disabled, so without JavaScript, you probably won't be able to get back to the server at all. As to server validation itself, it is no different than server validating any other controls when you use CustomValidator.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.