...

View Full Version : Help Me In This Scenario...



RoughGuy
05-07-2007, 04:52 PM
Hi friends... when i was developing some application with the implimentation of data base and data grid, i got a small problem... my scenario is...

i have a textbox and a datagrid in the page, i have list of student names in data base, when i enter some name in the data base the datagrid should be filled up with the name starting with that character with out occuring postback....

Suppose, if i enter, R in the textbox i should get names of students starting with "R", and then if i continue to type "Ro" the datagrid should clear the list and update with the names starting with "Ro"....

Can any help me in this plz.... Hope im clear with my doubt... Thanks in advance.....

nikkiH
05-07-2007, 08:37 PM
You need AJAX.
http://ajax.asp.net/ajaxtoolkit/AutoComplete/AutoComplete.aspx

RoughGuy
05-08-2007, 06:33 AM
You need AJAX.
http://ajax.asp.net/ajaxtoolkit/AutoComplete/AutoComplete.aspx

Thanks for the reply... I dont know Ajax, is there any other way 2 do this????

Krokador
05-08-2007, 01:57 PM
Nope not really. And AJAX is very easy to use, anyway. All you have to do is wrap your textbox and your datagrid in an updatepanel and add the autopostback="true" property to your textbox. Then you add the code for the textchanged event and what will happen is that oyur page will perform an asynchrous postback : only the part of the page in the updatepanel will refresh.

Just go to http://ajax.asp.net , you'll find the downloads for ajax and the control toolkit and some documentation too. You wouldnt need the toolkit in this case, but its always fun to take a look at it.

The only other way i could see would be to store all your info in a hiddenfield with something like commas seperating the fields, and using javascript to recover an array from that hiddenfield and then sort through it and display only whats needed. But that would be a real pain, and not very effective loadtime wise... So learning a bit more about ajax is your best bet ;)

nikkiH
05-08-2007, 04:13 PM
Thanks for the reply... I dont know Ajax, is there any other way 2 do this????

I linked you right to a pre-made component that is part of a toolkit that does an auto-complete, very similar to what you're wanting to do.

RoughGuy
05-09-2007, 08:15 AM
Thanks Friends, Trying 2 learn AJAX now, thanks for the site..... Can u plz gimme the link to download AJAX....

vinyl-junkie
05-09-2007, 01:05 PM
AJAX isn't something you download. Have a look at this tutorial (http://www.yourhtmlsource.com/javascript/ajax.html).

Krokador
05-09-2007, 01:57 PM
well there ARE downloads for the dlls you need to make ajax work (the asp.net ajax framework). Thought the link I gave ya was obvious enough, theres the download button right in your face when you first open the page: http://ajax.asp.net

And nikkiH has a point, the autocomplete might be something you'd be searching for, unless your point is not to select something but to show search data or the likes... Hope you find what you need anyway.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum