Adobe Dreamweaver Forums



Last 10 THreads :         flash loader reappears after movie plays (Last Post : lyshamo - Replies : 3 - Views : 4 )           »          cfimage error (Last Post : -==cfSearching==- - Replies : 1 - Views : 2 )           »          How to turn IMAGE into MOVIECLIP??? (Last Post : Snufferson - Replies : 7 - Views : 8 )           »          Embed files in a projector (Last Post : ytlevine - Replies : 0 - Views : 1 )           »          ColdFusion = "old technology" (Last Post : Ian Skinner - Replies : 7 - Views : 8 )           »          Load dynamic text into an embeded swf (Last Post : mikeyjray - Replies : 4 - Views : 9 )           »          Log email text (Last Post : Torgom - Replies : 0 - Views : 1 )           »          Properties > Flex Build Path (Last Post : kevxross - Replies : 0 - Views : 1 )           »          Can Anyone Help With Sub Menus (Last Post : Murray *ACE* - Replies : 8 - Views : 9 )           »          transferring DW license from crashed computer (Last Post : Sonjay - Replies : 1 - Views : 7 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 12-01-2008, 01:53 PM
Krish.praveen
 
Posts: n/a
Diggs:
Default Binding Grid with Web Services

Hi..

I am using web service to fill a grid, in the web method i have to pass two
parameters, it will return result of xml document. The same i want to fill in a
DataGrid using Flex.

Please help me..its urgent



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-01-2008, 02:13 PM
gallaharsha
 
Posts: n/a
Diggs:
Default Re: Binding Grid with Web Services

Hi,
This is very easy. Send a httpservice with the two parameters to the backend
which gives back an xml document. You can use that as the dataprovider of the
grid.
In case you want further details post the sample xml code and i can post a
detailed code as to how to do this . also mention the backend u r using..

Reply With Quote
  #3 (permalink)  
Old 12-01-2008, 03:03 PM
Krish.praveen
 
Posts: n/a
Diggs:
Default Re: Binding Grid with Web Services

Hi,
Thank you for reply..but i want to use web service instead of http service.
Sending you the sample code..please work on that and help me in binding to the
grid.

Sample.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" horizontalAlign="center" verticalAlign="middle" width="900"
height="600" creationComplete="initApp()"
backgroundGradientColors="[0x000000,0x323232]"
viewSourceURL="srcview/index.html">

<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.Label;
import mx.controls.Button;
import mx.controls.TextInput;
import mx.controls.DataGrid;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;

private function initApp():void
{
trace("Hello from Flex Debugging!");
}
private function auth():void{
S.Authenticate.send();
}
private function Authenticate_result(evt1:ResultEvent):void{
token.text = ObjectUtil.toString(evt1.result);
S1.GetloggedInUserList();
}

private function Authenticate_fault(evt2:FaultEvent):void{
token.text = ObjectUtil.toString(evt2.message);
}

private function GetloggedInUserList_result(event:ResultEvent):void {
token1.text= "Result";
var adgataGrid = new DataGrid();
dg.dataProvider= event.result.toString();
//adg.dataProvider = XML(event.result).toString();
}

private function GetloggedInUserList_fault(evt4:FaultEvent):void{
token1.text= "Fault";

}

]]>
</mx:Script>

<mx:WebService id="S"

wsdl="http://localhost:2630/Web%20Services/Authent ication.asmx?WSDL"
useProxy="false">
<mxperation name="Authenticate"
resultFormat="object"
result="Authenticate_result(event);"
fault="Authenticate_fault(event);">
<mx:request xmlns="">
<UserId>
{_txtuserid.text}
</UserId>
<Password>
{_txtpassword.text}
</Password>
</mx:request>
</mxperation>

</mx:WebService>
<mx:WebService id="S1"

wsdl="http://localhost:2630/Web%20Services/Resourc eManager.asmx?WSDL"
showBusyCursor="true" useProxy="false">
<mxperation name="GetloggedInUserList"
resultFormat="object"
result="GetloggedInUserList_result(event);"
fault="GetloggedInUserList_fault(event);">
<mx:request xmlns="">
<securityToken>
{token.text}
</securityToken>
</mx:request>
</mxperation>
</mx:WebService>

<mx:Label x="303" y="10" text="Login Procedure....." width="186"
fontSize="15" fontWeight="bold" color="#DFEAE7"/>
<mx:Button x="100" y="117" label="Login" id ="btnOk" click="auth();"
width="60"/>
<mx:Label x="100" y="172" id="token" color="#E3EEF1"/>
<mx:Label x="100" y="198" id="token1" color="#F4F8F9"/>
<mx:Label x="10" y="61" text="User Name:" id="_lblUsername" color="#F2EFEF"/>
<mx:Label x="20" y="87" text="Password:" id="_lblPassword" color="#F2EFEF"/>
<mx:TextInput x="100" y="61" id="_txtuserid" text="demo" width="142"/>
<mx:TextInput x="100" y="87" id="_txtpassword" text="demo" width="142"
displayAsPassword="true"/>
<mx:Button x="194" y="117" label="Exit" id="btnExit" click="this.close();"/>
<mxataGrid id="adg" width="100%" height="351" y="247" >

</mxataGrid>
</mx:WindowedApplication>

After login..i want to fill the result in the datagrid

Help me in doing the same
thanks in advance

Reply With Quote


  #4 (permalink)  
Old 12-01-2008, 03:23 PM
Krish.praveen
 
Posts: n/a
Diggs:
Default Re: Binding Grid with Web Services

I am using SQL as backend. This is called by webservice
Reply With Quote
  #5 (permalink)  
Old 12-01-2008, 06:24 PM
rtalton
 
Posts: n/a
Diggs:
Default Re: Binding Grid with Web Services

Looks like you are using ASP.NET
Dumb question: Does your web service method accept parameters?
Reply With Quote
  #6 (permalink)  
Old 12-02-2008, 06:23 AM
Krish.praveen
 
Posts: n/a
Diggs:
Default Re: Binding Grid with Web Services

Yes..i am using ASP.Net
Fine with the question, but its taking the parameters.

Only problem is to show result in the grid.
Please go to the code, which i worked on.

Thanks in advance
Reply With Quote


  #7 (permalink)  
Old 12-02-2008, 04:42 PM
rtalton
 
Posts: n/a
Diggs:
Default Re: Binding Grid with Web Services

I understand.

1) In GetloggedInUserList_result, get rid of the var "adgataGrid = new
DataGrid();". You already have the data grid declared in MXML so you don't need
to do this.
2) Instead of "dg.dataProvider= event.result.toString();"... (btw your
datagrid's id is "adg", NOT "dg")...
... try adg.dataProvider= S1.GetloggedInUserList.lastResult;

I can't see the data you are returning, but this should get you started in the
right direction.
Remember you can always examine the returned data and see how to assign it to
the datagrid's dataprovider property.

Reply With Quote
  #8 (permalink)  
Old 12-04-2008, 03:02 PM
Krish.praveen
 
Posts: n/a
Diggs:
Default Re: Binding Grid with Web Services

we are getting variable not found error. and our data returns from web service is in xml format. Is any process to convert xml to any format and then bind to datagrid?
Reply With Quote
  #9 (permalink)  
Old 12-04-2008, 03:23 PM
rtalton
 
Posts: n/a
Diggs:
Default Re: Binding Grid with Web Services

Check your returned data to see how it is formatted. XML format is fine to use for a datagrid.
Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 11:27 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk