guys anyone tried to create combobox list filtering using ASP.
i have 2 combo box. cbosupplier and cbocontact. once the user select from cbosupplier list, cbocontact should also filter its list
guys anyone tried to create combobox list filtering using ASP.
i have 2 combo box. cbosupplier and cbocontact. once the user select from cbosupplier list, cbocontact should also filter its list
ok ra na siya using javascript...
i was also thinking javascript.. hehe.. pro i dont know the capabilities of ASP man.. basin puydi diay asp?..
use javascript to post back the form..so inig select change (javascript) na event sa cbosupplier e post/submit nimo ang form..
poydi pud AJAX.. para di na kahinanglan i refresh ang page.
i tried javascript pro once magtawag ko sa
naa man gud ko submit button pra pro ang gamit niya dre pra sa combo box.
you can use a hidden html tag for the action..let say if update lang ka sa imong combobox e fill nimo og value ang hidden like "UpdateCombo" then post the form..so then sa imong server side code you query the value of the hidden then if ang value kay UpdateCombo so update the combobox items if dili then it means a submit button was clicked ^_^. Or if you want para pro-ness kaayo imo design use AJAX...i prefer using AJAX in this scenario ^_^
pde sample app brosend lng j.bantang@gpzgroup.com
sorry i dont have enough time to create sample app for you...so here is a litte hint on how to do this using ajax...
i call the frontend page as "testpage.asp" and "process.asp" as my main ajax gateway..
testpage.asp - i ommited the html tags..i just focus on the javascript involve
process.asp - this wil process ajax request you made in testpage.aspCode://initialize ajax <script language="javascript"> //not so good xml request initialization..hehe im just tired.. ^_^ xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("AJAX not supported!") return } </script> //so here is your onchange combobox <script language="javascript"> function combo1OnChange() { //you get the value of the selected combobox var combo1ObjValue = document.getElementById("combo1").value //construct the url, process.asp is where your request will be processed var serverURL = "process.asp?id=" + combo1ObjValue //example process.asp?id=1 //send your constructed url using html request xmlHttp.onreadystatechange = changeComboState //changeComboState - is a callback function xmlHttp.open("GET",serverURL,true) xmlHttp.send(null) } //this is the callback function function changeComboState() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { //if the request is completed you will have the result here...the results is // in xmlHttp.responseText, so you can return any //form of data may it XML, comma delimeted or etc...hehehe kaw na bahala..so if XML //imo e return, parse the nodes then populate it to your other cmbox (eg. combo2) //using javascript. } } </script>
Code:<% id = request.querystring("id") //process id here..may it you query the database or what just return using response.write, //so if xml imo e return contruct the xml data then use response.write()... %>
hehehe mobo ra kaayo bro..basically mao na iya structure if you are using ajax...heheeh cge tugpa sa ko..
enjoy :mrgreen:
tnx bro. try ko working on the code zzzpro mas maayo kong naa sample samot na samok non kay mag XML na pud
![]()
Similar Threads |
|