How To Manage Complex Data Entry Validation
Oct 18, 2010
I feel like I am fighting against the current when I develop ASP.NET Webform apps. I frequently run into the same problems, and while I eventually find some kind of workaround i'm never fully satisfied with the results.
Here is an example of a typical problem:
The design requires a grid or grid-like result set. This result set is pulled from a database, however, there are additional controls on each row that are not data bound, but their contents are used to insert data into other records.
A good example of this would be displaying a list of products, then adding selected products to a shopping cart based on values entered into quantity fields, and options selected per product. Throw into the mix that you have to allow multiple lines to be added to the cart at the same time, and it starts to get more complex.
Let's add to that mix that you can't select certain products together (mutually exclusive), that you can only select a certain number of one product, but not another, that prices may change while the user is selecting their items, that you you get an overall discount per item based on quantity purchased (both per item and overall order), that you are using a line of credit and cannot exceed the line of credit, nor can you buy more of a given item than an arbitrary amount set in your account or in the product by your account representitive (think certain over the counter medications that the government limits how many you can buy), etc.. etc.. etc..
What starts out as a simple grid with an add to cart becomes a hopeless mess of business logic, which then of course requires validation and notification to the user of various errors in their choices.
How does one deal with very complex data entry schemes in asp.net? How do you even begin to design a piece of software to do all this?
View 2 Replies
Similar Messages:
Dec 10, 2010
How are you all managing your web page state?
Anyone using complex database methods - so that a user can pick up a web experience that might have accidentally been left?
Anyone doing any complex state management for internal (INTRANET) sites? Where authentication is not an issue?
I'm looking for alternatives to simple SESSION() vbls.
View 6 Replies
Jan 15, 2010
I'm been working on a GetRuleViolations() method for my User class, but I'm getting a little hung up on on something:
What happens when different actions require different business rules?
My User table has the following columns: Id, UserRoleId, Username, and Password. Several actions involving User are possible (create new user, edit user, set/reset password, and log in), and the business rules for each are not always the same.
For example, when users log in, they are required to enter a password, but when admins create a new user, entering a password is not even an option. And in the case of setting/resetting a password, the password needs to be entered twice, and the two values need to be an exact match. What is the best way to handle this complexity? Is there some kind of design pattern to allow the right GetRulesViolations() method to be selected for the right circumstance?
View 2 Replies
Feb 23, 2011
I want to display an editor for a type User. User contains a field Address of type Address. I made an editor template for the type Address so that it is reusable.
I don't want the field Address to be required for creating a user. But some fields are required for Address, for example country, state etc.
I want to validate Address if I receive any data for it, if I don't receive anything, then I don't want to return any validation error to the UI for Address. I would return only validation errors for User then.
View 1 Replies
Aug 28, 2010
consider classic example: Product and Category editing Product in dropdown Id of Category is selected - Category mapped as object with all fields empty except Id when submitting Product edit form - validation gives an error: "Category name is required" (I have Required attribute on Category Name property)
How deal with such errors if I want to use built-in validation (
[Code]....
Writing custom data binder which would fill all such id-only-objects with values from database comes to mind.
upd: I did small research of mvc code and found out that validation happens before binding - so this solution would't work.
View 13 Replies
Feb 3, 2011
I have a question regarding validation of drop-down list values. I have a view that is bound to a view model type called ReservationData.
This object contains a property CustomerVehicles of type List<VehicleData>. VehicleDatahas two int properties VehicleMakeId and VehicleModelId.
On my view I am trying to loop over the number of items in the CustomerVehicles collection and displaying two dropdowns for each, a vehicle make dropdown and a vehicle model dropdown usingDropDownListFor.
When I try to submit and validate I do not see any validation errors displayed on the screen.
Just in case you are wondering I have added a ValidationMessageFor for each dropdown as well. I am not sure if this is an issue with the structure of my view model and its complexity and how the controls need to be named or how the ids need to be set.
Here is the code for the looping over the collection:
[Code]....
View 11 Replies
Nov 10, 2010
I need to show some html code in TextBox.this is my TextBox description:
<asp:TextBox ID="responseTextBox" runat="server"
Width="910px" ReadOnly="True" TextMode="MultiLine" CausesValidation="false" />
i am passing the html to it programatically, and it works, but on postback from page i'am getting the following error:
A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$responseTextBox=" ...
How can i disable input validation ?
View 2 Replies
Jun 27, 2010
I've got my validation wired up through my Service layer, and my Birthdate property looks like this.
[Code]....
The client side validation works properly if I input something like `12/12/1990` but when the form is submitted, the server side validation trips and I'm told the entry is invalid. I'm using the jQuery-UI Datepicker to input the date, however when I disable the datepicker, the problem persists.Am I missing something here? I thought the client side and server side would be the same thing.If I remove
[Code]....
Then the form submits. It's obviously something to do with the Regex.
View 8 Replies
Dec 25, 2010
I am using one datalist control for uploading multiple images.I hv used one Asp:FileUplaod Control and one button in one itemtemplate.I am using reqired field validator and regular expression validator for file upload cntrl I am assigning validation group for both of them on ItemDataBound event of my datalist so that each upload cntrl hv same validaton group as required field and regular expression validator.Now what i want to do is - i want to show my error message in validation summary which is right at the top of the page.I want one know how to write javascript that will assign validation group of my control in datalist on which i click ?
View 1 Replies
Sep 27, 2010
I'm working with a product called SiteFinity.I have a class which looks like so:
public class Categories
{
public IContent oContent {get; set;}
[code]...
View 2 Replies
Mar 15, 2010
In my past I had created the following web page in web forms and I'm learning asp.net mvc right now , I had given it a tought and I run into conclusion I really wont know how to do the same page with asp.net mvc
before explaining you the actuall problem I would explain you the Model The model is a pretty simple , it for few columns which are bool , and a lot of them which are varchar(MAX) The View is built the following way
the bool parts of curse got a check box but the varchar parts are the complicated ones In my web form page i got the following code for each varchar property in my database
[Code]....
my server script gets the following page apon submit and checks if radio button 1 or 2 is selected if 1. it inserts the link as it is into colmn property while if it is 2. it saves the file on the server and saves the file location into the colmn property.
View 3 Replies
Sep 8, 2010
a designer interface (like visio)2. client to display the content created within the designer interface.We have the design outline in place, the client will be in many forms, via the web using Flash or Silverlight (depending what's installed) and via windows using a WPF application.I would like to know what people think regarding storing information from the designer, all the clients will need to access the information via the internet so a database storage solution seems the first choice. But another alternative is exporting the information from the designer in something such as XML and storing that as a physical file
View 7 Replies
Jan 31, 2011
My DataTable is programatically generated, and contains objects of type JobInstance in the cells.
[Code]....
When I bind this DataTable to an ASP GridView, it only displays the first column. But if I remove the "typeof(Job)" when creating the column (the line with // !!!), the GridView displays all the columns by showing the result of JobInstance.ToString() in the cells. However, I have no access to the underlying JobInstance object, only the string values that are being displayed.
I need access to the JobInstance object when displaying the GridView (for example in the OnRowDataBound), because I want to access the fields inside JobInstance for each cell to determine formatting options, and add other links in each cell.
View 1 Replies
Dec 1, 2010
I have 2 classes that are used to mirror the data from an ajax call. One (Customer) contains a property which is name, and the other is an array of Products.
Public Class Customer
Private _Name as String
Private _Products as Product()
Public Property Name() As String
[Code].....
View 1 Replies
Oct 7, 2010
So part of my web app centers around this very important form which is used to create a form. Its like google docs form. The user keys in a type (checkbox, textfield, numericfield) and a label and slaps it into the system, and it generates a form somewhere.
Its a little more complex than google forms, the field types are complex and theres a lot more to that form (It happens to be a form generator for a finance plan)
The app is asp.net, I was thinking of using jquery and jquery's own ajax methods to post the data, but I think it would just turn into a very hairy situation, I then thought silverlight, but Ive never done silverlight before but I am an experienced .net guy.
So what do you guys think, will silverlight be too tough for a first timer for this kinda thing? Or should I stick to jquery. Plus points for silverlight is its an inhouse lan app and this particular page will be used by people with very high bandwidth.
Also I'm on .net 4 btw.
View 1 Replies
Apr 1, 2010
I have a data object where one of the properties is a collection of another data object. I never really figured out how to map this to a GridView, but I came up with a workaround. Now I am stuck and cannot figure out any way to do this in a ReportViewer.
Here is how I solved the GridView issue:
Say we have these objects:
public class BoysWithToys : List<BoyWithToy>
{
}
public class BoyWithToy
{
string FirstName { get; set; }
string LastName { get; set; }
int BoyNumber { get; set; }
List<Toy> FavoriteToys { get; set; }
}
public class Toy
{
int BoyNumber { get; set; }
string Toy { get; set; }
}
What I wanted to do was to map BoysWithToys to the GridView and present one GridView row per BoyWithToy record. Where there was more than one FavoriteToys record I wanted to list them in a bulleted list in the FavoriteToys column. I accomplished this by calling RowDataBound() for the GridView, casting the e.Row.DataItem to BoyWithToy, then looping through all of the FavoriteToys and adding each Toy to a bulleted list, then setting the column's text to that list.
I have no idea how to accomplish anything similar in ReportViewer. If I simply drag the BoysWithToys DataSource to the designer and run it, the FavoriteToys column shows '#Error'.
View 3 Replies
Apr 21, 2010
I'm trying to implement a recipe search page that allows users to specify search criteria by selecting checkboxes that match desired recipe attributes. All the data is stored in a database uing tables with 1 - many relationships. Each recipe can have multiple attributes from any of 5 attribute tables. I want to find all the recipes that match the user-selected criteria and display them in a grid. For example, the user may want a breakfast (attribute 1) recipe that is made with fruit and milk (attributes 2 and 3), is low-fat and high fiber (attributes 4 and 5), and takes less than 15 minutes to prepare (attribute 6). The query for this example might look something like:
SELECT distinct recipes.name, recipes.difficulty, recipes.preptime, recipes.cooktime
FROM recipes, recipeMeals, recipeDishes, recipeFoodGrps, recipeNutrients, recipeFixTimes
WHERE recipes.id = recipeMeals.recipeId and recipes.id = recipeDishes.recipeId and recipes.id = recipeFoodGrps.recipeId and recipes.id = recipeNutrients.recipeId and recipes.id = recipeFixTimes.recipeId and recipeMeals.mealId in (1) and
recipeDishes.dishId in (5) and recipeFoodGrps.fdGrpId in (1, 6) and recipeNutrients.nutrAttsId in (2, 3) and recipeFixTimes.fixTimeId in (1)
I' can generate the SQL but can't figure out how to bind it to a grid control. No could I see how to get any of the data controls to build the query for me. Is there a way to say "execute this query and display the results in a GridView"?
View 4 Replies
Dec 28, 2010
I have a table in my database with three fields: COURSE_ID, PERC, DATE.I need to display sets of rows based on the date, the number of rows in every set will be known at run time, the same as the number of sets, so I was thinking about adding two buttons (one to add a set and another to add rows in that set)
I know that working with GridViews will do, but do not know how exactly, maybe one gridview for the sets and a second gridview (inside the first one) for the rows inside the sets.
<Add Set>
<Add Row>
Set 1
COURSE_ID PERC DATE
2 10 2010-12-02
3 90 2010-12-02
Set 2
COURSE_ID PERC DATE
3 90 2010-12-10
4 10 2010-12-10
Set 3
COURSE_ID PERC DATE
3 80 2010-12-15
4 5 2010-12-15
5 15 2010-12-15
Set 4
COURSE_ID PERC DATE
2 100 2010-12-18
View 2 Replies
Oct 15, 2010
We know that using something like Bind("CustomerName") can be used in the Text property of a label control inside a gridview, where CustomerName is a property of the object whose collection is bound to the gridview. If that property is of a complex type (object of another class), how do we use a property of that inline object as a binding for the gridview column?
View 3 Replies
May 29, 2010
I have a date base with a table named 'movies'. I want to take information on my database. I use a SQLDataSource. For my presentation, I use a repeater. Here is my code :
[Code]....
But if for exemple, 'champ1' is empty in my database, i don't want to print it in the result of my query ! But i can't arrive ...
View 9 Replies
Mar 25, 2010
i have a datareader who read from data field from sql server, this field is datetime format now, when this field is null it returns 01/01/1900!! how can i manage it without if or some check, is there a property in datareader or sqlserver properties who i can return null value from datetime field?
View 4 Replies
Aug 16, 2010
On my web page I'm trying to manage a tabular control of some kind that supports inserting. The data will be inserted locally on the page, with no connection to any kind of DB. The inserted data will exist only on this page and will be lost after navigatingto another page.A table that shows all the added rows and has an empty row for inserting is perfect.
View 5 Replies
Oct 27, 2010
i am a new user of asp.net and i am a learner so i just want to connect two dropdownlist to data souce and i want that the list item of second dropdown is changed according to change of selected item of first dropdown.
i have connect it to data source successfully it getting chaged items but it happance only when its load then if i select the next item of first one it would not work properly.
View 3 Replies
May 30, 2010
provide tutorial/code sample on the most elegant and simple design in ASP.NET 3.5 for data entry forms (Select/Insert/Update/Delete)?
View 2 Replies
Mar 21, 2010
How can i prevent a user from entering the same data twice, i guess i need some validation in somewhere?For example:I add a name of a city, added successfully to the table.Try adding it again, click add and the program crashes.What type of coding do i need for this, some type of compare tool or something for the table?
View 1 Replies