Click to See Complete Forum and Search --> : ADO connection from javascript possible?


jmaton
January 7th, 2003, 11:22 AM
I have a rather interesting problem. I dynamically build a web page using CSharp (in Visual Studio .net the actual page building occurs in the page.aspx.cs file). This page is a list of cars, say, and is built by reading from a database. Each line has a combo box (in HTML it's a <select></select> block), from which you should be able to, say, change the color. When the user changes the selection in the combo box it should update the record in the database.

My problem is that since the combo boxes are generated dynamically, the function to handle them is a javascript OnColorChanged() function.
How can I make an ADO connection using javascript?

For those of you still with me, the better way to do this would be to have a System.Web.UI.WebControls.DropDownList member in the .cs file for each of the combo boxes. Then the onchange function could also be handled in the .cs file, where I have no problems making database connections. But since the number of cars is dynamic (built from the database), so too are the combo boxes, and I can't do such a thing.

Does anyone have any ideas?

Thanks all,
Jonathan

Thread1
January 22nd, 2003, 06:09 AM
I dont think of database manipulation in client side;) tsk! tsk!..

Well, I suggest that you create another ASP page to solve your problem. Here you can use whatever database manipulations stuffs because you are in the side of the server. This page will immediately redirect back to the page (creates the dynamic page) after updating the database.

Hence you said that you dynamically create the client page so inside the loop of the <select> you can include the script such
as...

<select name="select1" oncolorchanged="javascript::location.href=UpdaterASPpage.asp?<parameters need for updating>:cool: "....blah blah


In your ASP page (updater)..

<%

'
'
'Update database here....
'
'
Response.Redirect <back to the page you know>

%>


:cool: