Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

consume webservice 2

Status
Not open for further replies.

DotNetGnat

Programmer
Mar 10, 2005
5,548
IN
Hello All,

I have created a webservice and i have one function in it called GetData() which returns a dataset.

Now what i first tried is to consume this using ordinary webform controls and was successful without any problems...

then i tried to do the same thing using mobile controls...the page doesnt throw errors but i get a blank output...what am i doing wrong..here is my code...

MobileWebForm1.aspx
Code:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="MobileWebForm1.aspx.vb" Inherits="MobileWebApp1.MobileWebForm1" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<HEAD>
	<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
	<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
	<meta name="vs_targetSchema" content="[URL unfurl="true"]http://schemas.microsoft.com/Mobile/Page">[/URL]
</HEAD>
<body Xmlns:mobile="[URL unfurl="true"]http://schemas.microsoft.com/Mobile/WebForm">[/URL]
	<mobile:Form id="Form1" runat="server">
		<mobile:Label id="lblName" runat="server">Enter Name:</mobile:Label>
		<mobile:TextBox id="txtName" runat="server"></mobile:TextBox>
		<mobile:Command id="cmdName" runat="server">Go</mobile:Command>
		<mobile:List id="liststate" runat="server"></mobile:List>
	</mobile:Form>
</body>

MobileWebForm1.aspx.vb
Code:
Private Sub cmdName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdName.Click
        Dim ws As New myservername.myservicename
        txtName.Visible = False
        lblName.Visible = False
        cmdName.Visible = False
        liststate.DataSource = ws.GetData(txtName.Text)
        liststate.Visible = True
    End Sub

i used list mobile control...is it the correct one to use for holding the dataset??

-DNG
 
Do you have to call DataBind on mobile controls?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
i think we are getting there...i just added one more line to the code as you suggested...

liststate.DataBind()

then when i run the page i think i am getting the number of results correct BUT not seeing the actual data instead i am seeing System.Data.DataRowView

do i need to do something else to see the actual data??

-DNG

 
I guess you'll need to set the data text and/or value field then for that mobile control.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
not sure what to set DataTextField and DataValueField...i tried some variations...but didnt work...

-DNG
 
i think i figured it out partially...

when i use...

liststate.DataTextField = "Code"
liststate.DataTextField = "Description"

Code and Description are the two fields that my sql query is returning...

everything works fine but i only see Description listed but not code...

i was planning to display both the fields side by side...

-DNG
 
You are only seeing description because your code first sets the text field to code and then immediately sets it to description. If you want the two side by side you might have to use two controls or return the combination of code and description in your webservice.

HTH
 
after posting the question, i tried the combination thing and it worked fine for me...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top