Hi all , I am a newbie here, excited to join in this community. Here I have a question reg asp.net and MSaccess.
My application runs on asp.net with msaccess as backend. I need to implement a search, search by studentID which is an int. The user will put a studentID in the textbox and hit search button, it should search all details pertaining to the studentID in msaccess and should retrieve results in FORMVIEW/ EDITitem template(DAFAULT setting). So when i put studentID in textbox it takes as a string, how can i convert string to int and where? in C# pageLoad method? or searchbutton_click method? and how can i get the results back to formview? I would really appreciate your help
Thank You

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:

//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..

There are a couple of ways to do this. I tend to use: int i=Int32.Parse (<mystring>); Hope this helps.



try like this

int i=int.parse(textbox1.text);