Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi ,i want to take multiple employee ids in one shot from user and need to assign them to list .in asp.net ,pls help me to sort it out

What I have tried:

I have created a text box and tried with validator but it didnt worked out
Posted
Updated 10-Sep-20 20:15pm
v2
Comments
BillWoodruff 11-Sep-20 10:10am    
So show your code and the validator code, and see this: https://stackoverflow.com/a/1427777/133321

1 solution

Quote:
it didnt worked out

"it did not work" is one of the error reports we get quite often, and it's always completely useless - it tells us nothing about your problem other than "I have a problem" and we knew that because you are asking a question!

What did it do that you didn't expect, or not do that you did?
When did it do it?
Are there any error messages?
What did you do to make it do that?
What have you tried to do to find out why?
What were the results?
What help do you need?

These are all questions we need an answer to - or we can't help you at all!

At a guess, if you want multiple ID inputs, then your user needs to separate then with a specific character, such as a comma:
C#
1,2,3
Then you can just use Split to break them up:
C#
string[] parts = tbMultipleIDs.Text.Split(',');

ANd then convert them to integers in the usual way:
C#
int[] Ids = new int[parts.Length];
int i = 0;
foreach (string s in parts)
   {
   int id;
   if (!int.TryParse(s, out id))
      {
      ... report bad number to user ...
      return;
      }
   Ids[i++] = id;
   }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900