In a Web Forms application I present users with a list of items - each of
which the user is to assign to a grid. The grid is N rows by 3 columns.
The users enter the desired target cell for each list item by specifying two
integer values - one for the row number and the other for the column number
of the target cell.
When users submit the form for processing I need to validate that the
following are all true:
Please note that I can tackle 1 and 2 on my own as well as test for data
type, etc (will use RegEx). What I'd appreciate suggestions is how to
accomplish #3:
1. No value specified for RowNumber is larger than the total possible number
of rows.
2. Each value for ColumnNumber is 1, 2, or 3 (never zero, and never larger
than 3)
3. No cell is specified more than once (i.e., every combination of RowNumber
and ColumnNumber entered must be unique.
While this is a Web application, I'll be processing this on the server
during a postback.
Thanks. 2 1676
umm ...
You can use a 2 dim array for rows and columns with all cell initialized to
false, and once a use specify a row-column combination you can mark the
corresponding cell in the array as true. like this:
bool[,] cells = new bool[N,3]; // by default, all will initialize to false;
when i use specify a combination of row (r) and column (c), do simple check:
if (!cells[r,c])
{
// process this combination in the grid
// set the cell array to true
cells[r,c] = true;
}
I hope this solve your problem
--
Ahmed Ghozzy
"Jeremy S" wrote: In a Web Forms application I present users with a list of items - each of which the user is to assign to a grid. The grid is N rows by 3 columns.
The users enter the desired target cell for each list item by specifying two integer values - one for the row number and the other for the column number of the target cell.
When users submit the form for processing I need to validate that the following are all true: Please note that I can tackle 1 and 2 on my own as well as test for data type, etc (will use RegEx). What I'd appreciate suggestions is how to accomplish #3:
1. No value specified for RowNumber is larger than the total possible number of rows. 2. Each value for ColumnNumber is 1, 2, or 3 (never zero, and never larger than 3) 3. No cell is specified more than once (i.e., every combination of RowNumber and ColumnNumber entered must be unique.
While this is a Web application, I'll be processing this on the server during a postback.
Thanks.
Thanks! That looks simple enough. I'll give it a whirl.
"Ahmed Ghozzy" <Ah*********@di scussions.micro soft.com> wrote in message
news:90******** *************** ***********@mic rosoft.com... umm ...
You can use a 2 dim array for rows and columns with all cell initialized to false, and once a use specify a row-column combination you can mark the corresponding cell in the array as true. like this:
bool[,] cells = new bool[N,3]; // by default, all will initialize to false;
when i use specify a combination of row (r) and column (c), do simple check: if (!cells[r,c]) { // process this combination in the grid // set the cell array to true cells[r,c] = true; }
I hope this solve your problem -- Ahmed Ghozzy
"Jeremy S" wrote:
In a Web Forms application I present users with a list of items - each of which the user is to assign to a grid. The grid is N rows by 3 columns.
The users enter the desired target cell for each list item by specifying two integer values - one for the row number and the other for the column number of the target cell.
When users submit the form for processing I need to validate that the following are all true: Please note that I can tackle 1 and 2 on my own as well as test for data type, etc (will use RegEx). What I'd appreciate suggestions is how to accomplish #3:
1. No value specified for RowNumber is larger than the total possible number of rows. 2. Each value for ColumnNumber is 1, 2, or 3 (never zero, and never larger than 3) 3. No cell is specified more than once (i.e., every combination of RowNumber and ColumnNumber entered must be unique.
While this is a Web application, I'll be processing this on the server during a postback.
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Otto Krüse |
last post by:
Hi everyone,
I'm building a GUI in which I want, amongst other things, for people to
fill in there postal code. The postal codes of my country (Holland) are
in this format: 1234 AB
So for the input I use two entry widgets, one of a length of
(characters) for the numbers and one of lenght 2 for the letters. What I
don't like is that although the visible part of the widgets thus are 4
and 2 characters, users can actually input more...
|
by: Bill nguyen |
last post by:
I use the sub below to detect data entry error. The problem is that users
are still able to move out of the textbox AFTER the sub is run (and error
msg popped up) without having to correct the invalid data. In order to trap
all possible movements, I have to run the sub in Key events and Mouse
events. This is a lot of work.
I guess there must be a way to catch all key/mouse in and out the text box
so that we can run validation once and...
|
by: Furty |
last post by:
Hi,
I'm looking for the best practice for creating a generic data validation
implementation for my data bound business objects. I currently have a
business object base class implementing the following interfaces:
IEditableObject, ICloneable, INotifyPropertyChanged, and IDataErrorInfo
More specifically, my IDataErrorInfo implementation is like so:
|
by: peev2001 |
last post by:
Hi every body,
I have some basic queries regarding validation of data entered by different users:
I have a form from where the users are going to enter the data. I have tried to put some validation rule for the data entered and I am checking at the EXIT procedure of the objects. With this, whenever an incorrect data is entered a message pops up and the focus is set to the text box again for another entry. This thing works ok but I want to...
|
by: sellcraig |
last post by:
Microsoft access
2 tables
table "data main" contains a field called "code"
table "ddw1" is created from a make table query of "data main"
Goal-
the data in "code" field in needs to be inserted into a standard web
address in the table (the filed name is link) in ddw1
Example address ---
| |
by: tanhaa |
last post by:
Hi all,
Just curious if Javascript can do this for me:
I have data stored in a particular format and when displaying that
data, I want it to be shown in specific format.
E.G. Phone numbers:
the numbers are stored in a string format: 3335551212
|
by: sanou |
last post by:
Hi
No doubt this question, or a similar version of it, has been asked before. But, I was looking around the forums and i couldn't find anything.
I'm using VC++ to create a simple calculator that sums the values from 2 textboxes. I wanted to implement a simple data validation that would spit out various error messages if the user typed in incorrect data.
I managed to vomit out the following code. Yes I know it's beastly,...
|
by: Fanyang |
last post by:
Hi,
I am new to SQL.
I am building a form to do data entry. I have some questions in the questionnaire like:
a). are you qualified?
b). if you are qualified, which level?
I want to restrict the data entry for question b only when answer in question a is "Yes".
|
by: hippomedon |
last post by:
Hello everyone,
I'm looking for some advice on whether I should break the
normalization rule. Normally, I would not consider it, but this seems
to be a special case.
I have created an "Outcomes Database" used to store response data
from measures/ questionnaires for a longitudinal health study. It is
essentially derived from Duane Hookom's Survey Database (thanks
Duane!!!), with many modifications added to fit the needs of my lab.
|
by: vikas251074 |
last post by:
I am using ASP
In my company, all employees have to sent materials out of premises. Any employee who need to sent material out will use this web application. In the first page, an employee enters firm name, vehicle no, driver name, purpose, persons taking out, received by, remarks. In the second page, employee enters no. of materials to be taken out. In the third page, displays no. of rows for entry of material details like material name,...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |