Click here to Skip to main content
15,888,527 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: iframe Pin
siva45526-May-10 9:56
siva45526-May-10 9:56 
GeneralRe: iframe Pin
T M Gray28-May-10 5:16
T M Gray28-May-10 5:16 
Questiontiny mce editor issue Pin
trilokharry26-May-10 4:37
trilokharry26-May-10 4:37 
Questionhow to read first two letters from the string Pin
developerit26-May-10 3:30
developerit26-May-10 3:30 
AnswerRe: how to read first two letters from the string Pin
FarmerHE26-May-10 3:49
FarmerHE26-May-10 3:49 
AnswerRe: how to read first two letters from the string Pin
Tej Aj26-May-10 3:51
Tej Aj26-May-10 3:51 
GeneralRe: how to read first two letters from the string Pin
developerit26-May-10 22:01
developerit26-May-10 22:01 
AnswerRe: how to read first two letters from the string Pin
Pete O'Hanlon26-May-10 4:17
mvePete O'Hanlon26-May-10 4:17 
While you've been given fair advice on how to do this, I must urge you to consider the edge cases in your code. What happens if your user enters 1? Substring(0,2) will fail. What happens if they don't enter anything at all? What if they enter " 1"? Please ensure that your code copes with cases like these:
C#
public void FilterDepartments(string input)
{
  if (string.IsNullOrEmpty(input)) return;
  string filter = input.Trim(); // Remove trailing/leading spaces.
  if (filter.Length > 1)
    filter = filter.Substring(0, 2);
  // Now use the filter.
}

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



QuestionRad Ajax manager and rowclick event Pin
bigphish26-May-10 3:25
bigphish26-May-10 3:25 
Questionneed to create dynamic table Pin
dwadasi26-May-10 3:11
dwadasi26-May-10 3:11 
AnswerRe: need to create dynamic table Pin
Sandeep Mewara26-May-10 9:30
mveSandeep Mewara26-May-10 9:30 
GeneralRe: need to create dynamic table Pin
dwadasi27-May-10 23:41
dwadasi27-May-10 23:41 
QuestionGridview with A-Z Filter Pin
geeeeeeeetha26-May-10 1:02
geeeeeeeetha26-May-10 1:02 
AnswerRe: Gridview with A-Z Filter Pin
Sneha Bisht26-May-10 1:58
Sneha Bisht26-May-10 1:58 
GeneralRe: Gridview with A-Z Filter Pin
Arun Jacob26-May-10 2:20
Arun Jacob26-May-10 2:20 
AnswerRe: Gridview with A-Z Filter Pin
Sneha Bisht26-May-10 1:59
Sneha Bisht26-May-10 1:59 
QuestionConvert String to Int Pin
siva45526-May-10 0:28
siva45526-May-10 0:28 
AnswerRe: Convert String to Int Pin
Peace ON26-May-10 0:32
Peace ON26-May-10 0:32 
GeneralRe: Convert String to Int Pin
siva45526-May-10 0:39
siva45526-May-10 0:39 
AnswerRe: Convert String to Int Pin
Peace ON26-May-10 1:04
Peace ON26-May-10 1:04 
GeneralRe: Convert String to Int Pin
siva45526-May-10 1:41
siva45526-May-10 1:41 
GeneralRe: Convert String to Int Pin
FarmerHE26-May-10 1:59
FarmerHE26-May-10 1:59 
GeneralRe: Convert String to Int Pin
siva45526-May-10 2:41
siva45526-May-10 2:41 
GeneralRe: Convert String to Int Pin
michaelschmitt26-May-10 5:48
michaelschmitt26-May-10 5:48 
QuestionRetrive binary data from Sql Sever Database Pin
puja25-May-10 23:00
puja25-May-10 23:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.