manish_regmi
asked on
Calling a .net webservice to update list item from the data retrieved by the webservice
Hi,
I have a list with a customized newform.aspx. this forms has following fields
These all are list columns
1.SN
2.Address
3. Customer Name
4.State
5.Zip
After the SN field i have a button. Now my task is when i enter a value in the SN say 1 and click on the button then the following fields should be
2.Address
3. Customer Name
4.State
5.Zip
automatically populated.
I have created a webservice which takes the SN parameter and returns those data in dataset.
How can i use this in that button event in the newform.aspx...
Which will provide input parameters from one list field and autopopulate the result in other list fields...
I have a list with a customized newform.aspx. this forms has following fields
These all are list columns
1.SN
2.Address
3. Customer Name
4.State
5.Zip
After the SN field i have a button. Now my task is when i enter a value in the SN say 1 and click on the button then the following fields should be
2.Address
3. Customer Name
4.State
5.Zip
automatically populated.
I have created a webservice which takes the SN parameter and returns those data in dataset.
How can i use this in that button event in the newform.aspx...
Which will provide input parameters from one list field and autopopulate the result in other list fields...
ASKER
hi rajendra,
this is a customized newform.aspx of a lsharepoint list with the list fields. this is like a form to be filled up before creating a list item. i have designed a custom form using sp designer and added a button now i dont know what to write in the click event of the button....
this is a customized newform.aspx of a lsharepoint list with the list fields. this is like a form to be filled up before creating a list item. i have designed a custom form using sp designer and added a button now i dont know what to write in the click event of the button....
A solution I've used quite often in the past for this exact scenario is to use jQuery to query the webservice and then fill in all the required values.
Just attach a click event on the button using jQuery and using the $.ajax method you can query the webservice.
To make things easier I'd use a custom handler (ashx file) instead of a webservice. This custom handler would receive the SN in the querystring and would return a JSON array with the output values.
This way you can achieve your goal with a minimum of coding both on the WS side and SharePoint.
Just attach a click event on the button using jQuery and using the $.ajax method you can query the webservice.
To make things easier I'd use a custom handler (ashx file) instead of a webservice. This custom handler would receive the SN in the querystring and would return a JSON array with the output values.
This way you can achieve your goal with a minimum of coding both on the WS side and SharePoint.
ASKER
i am following the same way but it is not working do you have any sample code.
ASKER
I am trying with no luck i have a input button in the NewList Form I have written an EventHandler code to communicate with the webservice but when i click on the button i get nothing
<input id="Hello" name="Button1" type="button" value="button" />
attached is the code for the Click Event of the Button
<input id="Hello" name="Button1" type="button" value="button" />
attached is the code for the Click Event of the Button
$(document).ready(function() {
$("# Hello ").click(function(event){
var soapEnv =
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
<soap:Body> \
<GetCustomerInformation xmlns='http://tempuri.org/'> \
<CustomerName>Microsoft</ CustomerName > \
</ GetCustomerInformation > \
</soap:Body> \
</soap:Envelope>";
$.ajax({
url: " http://fm2k8sp-stg:20566/_vti_bin/Customers.asmx ",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=\"utf-8\""
});
});
});
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for the support i did finished that code...but i m still in the same problem..
in above code where i have <CustomerName>Microsoft</ CustomerName > \
in case of microsoft here i want to pass the text of my sharepoint field whatever is in there....
in above code where i have <CustomerName>Microsoft</ CustomerName > \
in case of microsoft here i want to pass the text of my sharepoint field whatever is in there....
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Alot it worked Pefectly
I am sorry to say but i still have the half of the problem
I am using the following Function to get those data into XML
function processResult(xData, status) {
alert(status);
alert(xData.responseXML.xm l);
Now i need to push back the data obtained to SharePoint Fields parsing the XML...
Any idea on this
I am sorry to say but i still have the half of the problem
I am using the following Function to get those data into XML
function processResult(xData, status) {
alert(status);
alert(xData.responseXML.xm
Now i need to push back the data obtained to SharePoint Fields parsing the XML...
Any idea on this
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
I apologize, if I have not understand your problem completely.
Please let me know, how you have customized newform.aspx. Have you used SharePoint designer or modified control templates.
Also, you can think of writing a custom webpart which have all the controls required. It can call your webservice and populate the same. It would give you all the options to write your own custom code.
Cheers ....
Rajendra