Showing posts with label webservice. Show all posts
Showing posts with label webservice. Show all posts

Wednesday, March 28, 2012

Pre selected item in a cascading dropdownlist

I have a set of 3 dropdowns that im using the cascading dropdownlist ajax with. They all load corectly with the webservice and work great, but the form is an inventory entry screen and I need to update an existing inventory sometimes. So is there a way to pre-select all 3 dropdown list boxes? I tried "CascadingDropDown1.SelectedValue = "MACK";" but it gets erased when the webservise returns the data.


Maybe you got it solve by the date, but i figure out a way to lead with cascadingDropdownlist and preselection.
In my case I have 3 dropdownlist (ddl) inside a formview and depending is a session variable is already filled the value for the first DDL (parent) is changed.

In the following code, FvwPostOff is a formview which contents my DDL and CascadingDropDown (CddBuilding) extenders. The thing is to set the value by the CascadingDropdown extender instead of the DDL direclty:

ElseIf (Session("BUILD_NB") IsNotNothing)Then Try Dim CddBuildingAs CascadingDropDown = FvwPostOff.FindControl("CddBuilding") CddBuilding.SelectedValue = Session("BUILD_NB")Catch exAs IndexOutOfRangeException' nothingEnd Try End If
Hope this help

Saturday, March 24, 2012

Problem calling webservice from client code

Hi All,

I am trying to call a webservice method on a ASP.NET page (in AJAX enabled website). I have my asmx file in the same project as my ASP.NET page. When i try to compile the project , i am getting a "Could not create type TestService" error. Can some body tell me what exactly is the problem here?

Thanks

Mahesh

Confused cud u have given namespace reference of web.script.services.scriptservices

as using web.script.services.scriptservices

& inherite [ScriptServices]


Thanks for the reply ranjeet. But i don't really get the gist of your message , can you please be more clear? I am copying my webservice code below for your reference:

using System;

using System.Web;

using System.Collections;

using System.Web.Services;

using System.Web.Services.Protocols;

using System.Web.Script.Services;

using System.Data.SqlClient;

using System.Data;

///<summary>

/// Summary description for TestService

///</summary>

///

namespace MyTestService

{

[WebService(Namespace ="http://tempuri.org/")]

[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]

publicclassTestService : System.Web.Services.WebService

{

[WebMethod]

[ScriptMethod]

publicDataSet GetEmployeeDetails(int empID)

{

String strConnectionString =String.Empty;

String strQuery ="Select * from Employee where EmployeeID = " + empID; ;

strConnectionString ="Server=PC21172\\SQLEXPRESS;Database=EmployeeDB;user=sa;pwd=pwd";

//Get the employee details for the passed id

SqlConnection c =newSqlConnection(strConnectionString);

c.Open();

SqlDataAdapter dataAdapter =newSqlDataAdapter(strQuery, strConnectionString);DataSet dsEmployeeDetails =newDataSet();

dataAdapter.Fill(dsEmployeeDetails);

return dsEmployeeDetails;

}

}

}

Thanks

Mahesh


The DataSet and DataTable is supported in the v1.0. You have add the preview version.


Hi,

I have infact downloaded the January CTP and i am able to return the datatable. Now th issue is , how can i bind the datatable or dataset that i return from the webservice to a ASP.NET datagrid control in javascript call back function. Can somebody help me on this?

Thanks

Mahesh


The Asp.net DataGrid/GridView does not have any objectmodel in the client side. Few days back I wrote a component which does the exact thing, Checkout the following article:http://dotnetslackers.com/articles/ajax/ASPNETAjaxGridAndPager.aspx

Problem converting inserted html to ajax client control

Hi,

im inserting a htmltable which is returned by a webservice into a div container.
My problem is that i am not able to create a client control out of this htmltable (or its child elements)
although its inserted properly. It seems that inserted HTML is not available in the dom right after insertion.
Any suggestions?

thank you!
spoekes

Try to post some codes and give us some brief description here.We will try our best to help you.

Problem in calling a Webservice in ATLAS Application.

Hi Every body im new to this community,

Im facing problem in calling the webservice from ATLAS Application .

If the WEbservice is in the same solution im able to do it, but when i create a new webservice and try to call in my ATLAS application im not able to do it,

Im getting following Error "

<atlas:ScriptManagerID="NamSpacescriptManager"EnableScriptComponents="false"runat="server">

<Services>

<atlas:ServiceReferencePath="SimpleService.asmx"/>

<atlas:ServiceReference

Path=http://localhost:3505/SimpleCalculator/SimpleCalculator.asmx/>

</Services>

</atlas:ScriptManager>

<scripttype="text/javascript"language="javascript">

function OnAddServiceClick( )

{

var response = SimpleCalculator.Add(3,3,Oncomplete,OnTimeOut,OnError);

returnfalse;

}

</script>

Im getting Error : SimpleCalculator , undefined, can i know what is wrong ...

Regards,

Hi,

The problem is that, a service reference to a web service causes an xmlscript reference in the generated page through a "/js" call to the web service.

If you examineCalling a simple Web Service from an ASPX page quick start sample, when you add
<atlas:ServiceReference Path="SimpleService.asmx" />
to your source, what is rendered as xmlscript is:
<references>
<add src="http://pics.10026.com/?src=SimpleService.asmx/js" />
</references>

Call SimpleService.asmx/js and you will get this piece of javascript:
Type.registerNamespace('Quickstart.Samples'); Quickstart.Samples.SimpleService = new function() { this.path = "http://atlas.asp.net/quickstart/atlas/samples/services/SimpleService.asmx"; var cm=Web.Net.ServiceMethodRequest.createProxyMethod; cm(this,"EchoString","s"); }

So, behind the scenes, Atlas client framework makes a call to the web service, asks the service to describe itself in javascipt and registers a function for you to call later from your code.

But there's no such default "/js" handler in web service world. Instead, Atlas provides necessary handlers in web.config to reply requests for "webservicename.asmx/js". That's why it works when your web service is in the same project with your Atlas GUI project.

If you enable the Atlas handler for .asmx files in your web service project as in your GUI project, it should work fine.

Wednesday, March 21, 2012

Problem in invoking Webservice in ATLAS.Application

Hi Everybody,

Im facing problem in calling Webservice in ASP.NET ATLAS Page.Im trying to invoke a Webservice which is external to my system , in my application as follows:

<atlas:ScriptManagerID="NamSpacescriptManager"EnableScriptComponents="false"runat="server">

<Services>

<atlas:ServiceReferencePath="SimpleService.asmx"/>

<atlas:ServiceReferencePath="http://www.xmlwebservices.cc/ws/v1/calc/SimpleCalc.asmx"/>

</Services>

</atlas:ScriptManager>

function OnAddServiceClick( )

{

var response = SimpleCalc.Add(3,3,Oncomplete,OnTimeOut,OnError);

returnfalse;

}

in this above case, I went thru the WSDL and found the name of Class as SimpleCalc hence was trying to invoke the method ADD , May i know what is wrong in this ,

Or is it ATLAS doesnt support mechanism to invoke a webservice other than local system.

I would also like to know internally how ATLAS is invoking the Webservices, ie, Proxy classes ., how is it done .,

Thanks & Regards

Lohita

It looks like you might have neglected to instantiate the web proxy object in your Javascript, as in the following manner:

var calcSvc = new SimpleCalc();

var request = calcSvc.Add(...);


Is that something new? Because in the February CTP, I was just calling WebMethods like ..
var request = SimpleCalc.Add(...) and it was working fine. I'm about to try instantiating it now, but
I'm wondering again, if that's new .. or if something stranger is going on.

No, this has not changed, and you don't need to instantiate it.

Calling cross domain services is tricky, as it runs into browser security limitations. If the other server is also running Atlas, the March release has some support to make it work. If not, you should look into the new bridge feature (see Atlas docs and samples for details).

thanks,
David


I was actually wrong in my previous post. Your problem here is that you cannot make a web service call to a domain other than that which your page comes from. In order to do this, you must "bridge" the call through your web server using the new Bridge functionality added to the March CTP.

Hi David,

What do you mean by "If the other server is also running Atlas.." Does it mean the external webservice which we call using bridge feature should also have Microsoft.Web.Atlas.dll in its bin directory?

Thx, Vishant


No, I was referring to the ability to call services on a different server directly from the client. The bridge feature always goes through your Atlas server, and has no restrictions on what other servers it can bridge to.

David