AJAX :: How To Pass 2 Variable Values Using JavaScript To A Web Service

Mar 7, 2010

How can I pass two variable values to a web service web method using JavaScript and a DynamicPopulateExtender?

Some background of my issue:

I have a fully working cascading drop down list accessing a database.

My parent Cascading Drop Down List is a list of countries and the child displays the relative regions i.e.: USA returns Iowa, Maryland, Oregon etc.

I also have a 3rd Drop Down List control that allows the user to select the language to display the region details i.e.: Selecting the language of Chinese will return a list of regions of the USA in Chinese (held in the database).

I now want to display the translated country name from the 3rd Drop Down List in a label on the page.
I cannot just use the text from the country drop down list as this text value remains in English. The translated value must be returned from the database.

So far, I have installed a DynamicPopulateExtender:

[Code]....

I then wrote a web method (in the Cascading Drop Down local Web Service) to return the translated country name. To do this I have had to hard code the countryID (10663) and the translationLanguageID (1331) asshown below:

[Code]....

This does return the translated country name, but the variables are hard coded!

My question is how do I pass the countryID and the translationLanguageID to the Web Method GetTranslatedCountryName() from the DynamicPopulateExtender? Or even if there is a better way to achieve my task?

View 2 Replies


Similar Messages:

How To Pass JavaScript Function As A Parameter In The Route Values Of Ajax Actionlink

Apr 20, 2010

I need to pass javascript function as a parameter value to the ajax actionlink in asp.net mvc app. how can we achieve this?

View 1 Replies

AJAX :: Pass And Save JavaScript Array Values To Database Using JQuery?

May 7, 2015

I have create a web page having dynamically created text boxes if  i select value in dropdown list,text boxes auto generates .but i want to save all text box values in SQL server database after clicking on submit button using ajax/JSON request

View 1 Replies

Pass Javascript Variable To Asp Code With MVC

May 27, 2010

for(var i=0; i<<%=Model.Mydatalist.Count%>;i++)
{
//then I need to pass i to Mydatalist like Model.Mydatalist[i]
}
//var myJSdata="<%Model.Mydatalist["&i&"]%>";

is not working.. as system see i (i's value) as a string, and will throw exception: cannot convert string to int.

View 1 Replies

How To Pass Values To The Web Service

Jan 27, 2010

I would like to discuse with u, now i have one problem, ie, how could i pass value from the code behind to the web service, in that ,i have to pass 3 values,1, context key2, prefix text3, dropdown selected text or value, ( Contains Designation Details)how could i pass this 3rd value

View 1 Replies

Data Controls :: Send (Pass) GridView Row Values To Next Page Using Session Variable

Nov 6, 2013

i have a gridview with link button and one field called "ID" i have five values....when i click the link button that row value ill show in next page in textboxes ,txtid, txtage, txtsalary,......... if i click that link button that "Id" values should pass to next page using "SESSION" variable in C#.net

View 1 Replies

Web Forms :: Pass Variable As Html Control Through To Javascript Function

Jan 24, 2011

I have a function that gets the position of a control.

[Code]....

All the function needs is an htmlcontrol being fed to it as the parameter (elemRef). I can declare a variable in Javascript of the same content page but different function and pass the parameter successfullly getting returned values. For example, if I have the following function:

function (getPosition)
{ var txtBox1 = document.getElemendById('<%=txtBox1.ClientID %>');
getPos(txtBox1);
}

I will get the coordinates of the control txtBox1. But how can I accomplish this if I am calling this function from a javascript function or codebehind of the Master Page, or codebehind of the same content Page.

View 4 Replies

Web Forms :: Using Javascript, Call One Function From Another, Pass A Variable That Represents?

Jan 20, 2011

I have a variable created to manipulate a contorl on a page:

var pnl= document.getElementById('<%=pnl1.ClientID %>');

[Code]....
[Code]....

View 1 Replies

Web Forms :: Get The Values Of Session Variable 'x' Through Javascript

Oct 29, 2010

I need to query for a session variable called 'steps' every 10 seconds from my Webform in ASP.Net using javascript. This session variable holds an integer value.

View 3 Replies

How To Pass Values To Javascript From Code Behind

Oct 28, 2010

Basically I want to display a popup box only at a specific time in asp.net application. so i'm using the following

[code]....

but this code is not working. the alert box is not popping up. is this a correct method to pass values to the script?. or what else to be done to meet the requirement?.

View 1 Replies

How To Pass Values From Querystring To JavaScript

Nov 4, 2010

Now that i learned how to pass values to an SWF object via flashvars, how can i pass values from a querystring to javascript?

What do i mean? In the following example i hard-code the xml file to load in the SWF object.

<script type="text/javascript">
var so = new SWFObject("preview.swf", "", "100%", "100%", "9", "#ffffff");
so.addParam("allowFullScreen", "true");
so.addParam("scale", "noscale");
so.addParam("menu", "false");
so.addVariable("xmlPath", "xml/exampleData.xml");
so.write("flashcontent");
</script>

Since the Xml file is created dynamic, the xml should be loaded from the value of a query-string. (I guess).

Supposing my url is http://www.example.com/load.aspx?XmlFile=SomeData

How can i pass it to the javascript side? Like..

so.addVariable("xmlPath", "xml/<% SomeData %>.xml");

or whatever it needs to make it work.

UPDATE: Besides the above example, is there any way of creating the JavaScript, in server-side?

View 3 Replies

How To Pass Null To A Nullable Parameter Of A .NET Web Service Method Via Javascript

Aug 24, 2010

[System.Web.Script.Services.ScriptService]
public class Quotes : System.Web.Services.WebService
{
ebMethod]
public void Calculate(int param1, int? param2)

View 2 Replies

AJAX :: Cascading Dropdowns - How To Add / Pass An Additional Variable To Dropdown

Jul 1, 2010

I have a working version of cascading dropdowns.

the code line that adds each item into dropdown is:

[Code]....

View 1 Replies

AJAX :: How To Pass Session Variable As Context Key In Autocomplete Extender

May 27, 2013

I have AjaxAutocomplete textbox but its not taking session parameter, when I am typing some words its showing all data without any filter, means its not taking session variable after where, in select query.

View 1 Replies

Forms Data Controls :: Pass The Fields Values To The JavaScript Variables

Mar 13, 2010

i am still stcuk with my project and unabale to perform calculation on my edited gridview..

here is my problem :

i have fields (f1,f2,f3, f4...) pulled from my sql data base table. into a gridview.

the "f4" field value is based on some calculation done on f1, f2 & f3 field values..

1- i need to have the same calculation done when i edit and update f1, f2 & f3 on my gridview...

more complicated..

2 -my calculation are based on a javascript function ...

a- how can i pass the fields values to the JavaScript variables...perform the calculation....then reassign back the result varibale to the f4 field ?? ..then update my gridview with the new calculation..

[code]....

View 6 Replies

Data Controls :: Pass Multiple Eval Values To JavaScript Function Inside GridView

May 7, 2015

I want to pass hidden variable to javascript from href. Below is the code used

<input runat="server" id="hidOrganizationId" type="hidden" value="" />
<ul class="gloMenu">
<li id="liOrg" runat="server">
<a href="javascript: DataEncryption('../Admin/DetailPage.aspx?OrganizationId=' + hidOrganizationId)">
<b>Ordering Facility</b>
</a>
</li>

View 1 Replies

Pass A String To A Web Service Using JQuery / JSON / AJAX?

Oct 29, 2010

As it is now I create a JavaScript object and then stringify it, put it in a hidden textbox and my code behind can read this string. I then use JSON.NET to parse the string which works fine. I now try to use ajax to post it to my web service but have some issues with how to send the string. I have tried many ways but gets the common errors like

Invalid JSON primitive: myString.

So I checked this out [URL] and it works with hard coded values but I want to use a variable.

JavaScsript to create the object:

for (var i = 0; i < results.rows.length; i++) {
var row = results.rows.item(i);
var customer = new Object();
customer.id = row['id']
customer.name = row['name']
var customerString = JSON.stringify(customer);
$.ajax({
type: "POST",
url: "synchronise.asmx/synchroniseCustomers",
data: "synchroniseCustomers: " + customerString,
contentType: "application/json; charset=utf-8",
dataType: "json",
error: function (xhr, status) {
alert("An error occurred: " + status);
},
success: function (msg) {
alert("success");
}
});
}

WebMethod:

public void synchroniseCustomers(string customerString)
{
JObject o = JObject.Parse(customerString);
string id = (string)o["id"];
string name = (string)o["name"];

If I use data: '{ FirstName: "Dave", LastName: "Ward" }'

in the example above it works but I wish to pass on a string instead.

View 2 Replies

Jquery Ajax Call To Web Service - Canīt Pass Parameters?

Nov 6, 2010

Iīm using jQuery to make the ajax calls to web services. Iīm not using json, I want the information in XML. If I donīt pass parameters and I make the WS parameter less it works but if I want to pass a value as parameter (I tried int and string) it doesnīt work. Here is my code:

jQuery: [Code]....

The web service

[Code]....

The error that I get from firebug is an exception System.InvalidOperationException and it says that the parameter region_id is missing.It canīt be very difficult because it works without parameters but all the information I find in internet

View 5 Replies

AJAX :: Pass Multiple Parameters To Wcf Service Using Auto Complete Extender?

Feb 10, 2011

I have a wcf service and method returns a string array as follows

[Code]....

How can I pass required multiple parametes (name, cuo, year ) to this service using ajax AutoCompleteExtender.

If I could not use autocopleteExtender what would be the best way to achieve this.

View 1 Replies

Ajax Tab Container - To Save The Value From The Javascript Box Into A Variable?

May 17, 2010

I am using the ajax control toolkit tabcontainer with 5 tab panels inside of it. Each tab contains areas where one must input information. The page also contains add, edit, and delete buttons with gridviews above them. What I am trying to do is to make the user save or cancel changes when they change the activetab. I am using a javascript confirm box but I need to try to retrieve the value of what is pressed from the javascript box to decide whether to discard the changes or stay on the page and make the user finish the input. Is there any way to save the value from the javascript box into a variable so or must i try something else?

PS I wasnt sure whether to post this in the javascript section or the asp.net section since im using asp.net with c#.This is kinda what im using but would like to turn it into a confirm box and pull the true or false value.

protected void TabContainerContent_ActiveTabChanged(object sender, EventArgs e)
{
if (TabContainerContent.ActiveTabIndex != 0)
[code]....

View 16 Replies

AJAX :: How To Pass More Than One Control Values To Webmethod For AutoCompleteExtender

Apr 5, 2010

I am developing a user control. This user control is having 2 Dropdown controls and one textbox('txtCustomer'). I am using autocompleteextender for the text box. This 'txtCustomer' control populates the data based on the value selected in 2 dropdowns.

I need to pass the selected value of this 2 dropdown to my meb method. I am not using web service(.asmx page) for this application instead i am using page level web method. I tried to access the controls from the web method inside the Page. but all the identifiers and controls of the page returning null in the web mothod. I have analysed it is because the events "page_Load and page_Init" are not getting fired.

View 6 Replies

JQuery :: Multiline Textbox And Javascript Variable Using Ajax?

Jul 12, 2010

In my web application I have a textbox called "Address" which is multiline and have 3 rows and 250 characters.

I am calling a javascript function in which i am calling AJAX to send the data to a webservice for some processing but AJAX is unable to process variable which contains multiline text.

I am reading multiline textbox value like this in javascript function.

var puid = document.getElementById('<%=userid.ClientID%>').value;
var paddress = document.getElementById('<%=xaddress.ClientID%>').value;

and passing like this.

$.ajax({
type: "POST",
url : "DataService.asmx/UpdateProfile",
data: "{'puserid': ' " + puid + 'padd': ' " + paddress + " '}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: OnError
});

If I comment paddress parameters in ajax "data:" it works fine other wise ajax goes on "OnError" ...so how to handle multiline textbox values in javascript.

View 9 Replies

AJAX :: Dropdown List In Javascript Using Ajax Service But Unable To Get Its Selected Value In Button?

Apr 6, 2010

I am using ASP.Net 3.5. I have fiiled dropdown list in javascript using ajax service but unable to get its selected value in button click event on server side.

View 1 Replies

Ajax - Pass A Javascript Value In Server Side?

Sep 6, 2010

how can I pass a client side (JS) value in server side (C#)?

e.g.

I have a generated table (after uploading images) and it contains images and I want to select the image and throw the ID back in server side.

The uploade I used was JQuery Uploadify and I have a "onComplete" function

[code]...

View 2 Replies

AJAX :: Pass Multiple Parameters From C# To JavaScript?

Jan 26, 2010

i want to update my page from database every 20 Sec..so for that i want to pass multiple data fields from server to Client using AJAX.. what can i use for that except using xml?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved