updating javascript value to database
-
Dear all, I am facing a problem with a javascript function i had with me javascript for country generation and also on change of country state generation w.r.t of country but i want to fetch the selected value of country and state and to update in the database using sqlserver.
sai krishna
-
Dear all, I am facing a problem with a javascript function i had with me javascript for country generation and also on change of country state generation w.r.t of country but i want to fetch the selected value of country and state and to update in the database using sqlserver.
sai krishna
If you divide your text into sentences, it might be possible to understand what you are trying to say. As I gather it, you want to do something (update? insert?) with an MS SQL Server database from Javascript? You can't do that. Well, it's possible, but that would mean that you expose your database login to everyone. You have to post the information to the server, where you do the database work.
--- single minded; short sighted; long gone;
-
If you divide your text into sentences, it might be possible to understand what you are trying to say. As I gather it, you want to do something (update? insert?) with an MS SQL Server database from Javascript? You can't do that. Well, it's possible, but that would mean that you expose your database login to everyone. You have to post the information to the server, where you do the database work.
--- single minded; short sighted; long gone;
Thanks guffa, for ur prompt msg, but i have a javascript code written for country selection and this is the aspx statement i am writing to call javascript but in the javascript onchange event is to give the corresponding state of the country another javascript so what i have to do to get the selected value of the country thanks once again
sai krishna
-
Thanks guffa, for ur prompt msg, but i have a javascript code written for country selection and this is the aspx statement i am writing to call javascript but in the javascript onchange event is to give the corresponding state of the country another javascript so what i have to do to get the selected value of the country thanks once again
sai krishna
I'm not entirely sure I understand your problem either, but what it sounds like you want to do is populate a state combo box based on the users selection in a country combo box. You don't want connection strings in your web page unless your resume is up to date. I think you're going to have to look into an ajax solution unless you want to do a full postback each time the user changes their selection.
J
Make the logo bigger
-
Dear all, I am facing a problem with a javascript function i had with me javascript for country generation and also on change of country state generation w.r.t of country but i want to fetch the selected value of country and state and to update in the database using sqlserver.
sai krishna
dsaikrishna wrote:
I am facing a problem with a javascript function i had with me javascript for country generation and also on change of country state generation w.r.t of country but i want to fetch the selected value of country and state and to update in the database using sqlserver.
Okay. #1. Declare one variable in code-behind to hold the status.
string selectedCountry = string.Empty;
#2. Add one server-side hidden field (a HTML hidden field with RunAt="Server") in your page.<input id="Hidden1" type="hidden" runat="server" onserverchange="Hidden1_ServerChange"/>
#3. Add change event of this hidden fieldprotected void Hidden1_ServerChange(object sender, EventArgs e) { }
#4. In onchange event of Country list, you can set the value to this hidden field.. For example, if you select "Singapore" from combobox, set this to hidden field by using javascript.var objHdf = document.getElementById('Hidden1'); objHdf.value = document.getElementById('cboCountry').selectedtext;
#5. As soon as the value of hidden field get changed, the server side event of hidden field will be invoked. So, get the value from hidden and set it to string that we declare earlier..protected void Hidden1_ServerChange(object sender, EventArgs e) { selectedCountry = Hidden1.Value; }
Okay. now, you get the value so, you can insert it to SQL database.. Hope it helps.. :)Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)