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 1662
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*********@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.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...
|
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...
|
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...
|
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...
|
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...
|
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:...
|
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...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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,...
|
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...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
| |