Hello Venkatad!
If I were you I'd use the searchbutton_click method, get the text directly from the textbox, then do the convert. The code is:
try{
Convert.ToInt32(StudentId.Text)
}
catch(FormatException)
{
//warn if the box contains characters which are not numeric..
}
However if the textbox is inside a formview, you may encounter an error like "Target is not instance of an object, etc", so first you have to find the box.
The code would be something similar: TextBox StudentId = (TextBox) FormView1.(ItemTemplate).FindControl("StudentId");
ItemTemplate is in () because I don't remember if it's necessary..
konczuras
Junior Poster in Training
59 posts since Oct 2008
Reputation Points: 10
Solved Threads: 1