Thanks Steve. I have managed to get this working as follows.
Dim ws As New DataServWS.dataserv
Dim strWS As String = String.Empty
strWS = DirectCast(fvAccommodationDetails.Row.FindControl("litServiceAddress"), Literal).Text
If strWS <> String.Empty Then
ws.Url = strWS
gvCalendar.DataSource = ws.GetCalendar(Date.ParseExact(txtStart.Text, "d", System.Globalization.CultureInfo.CurrentCulture))
gvCalendar.DataBind()
End If
I was trying to use the ObjectDataSource linked directly to the Web service, but was not able to change the Web Reference URL that way.
Is this the best way to go about the problem though, or should I be looking at jQuery/AJAX?
cmsesan1
Member
469 Points
188 Posts
Changing the Web Reference URL
Feb 25, 2010 08:57 AM|LINK
I have a GridView on my main page, and each record contains the address of a different Web service.
When a user clicks on a record they are directed to a details page for whatever they have chosen.
I am displaying a GridView on the details page with an ObjectDataSource pointing to a Web service.
My problem is that I somehow want to change the 'Web Reference URL' depending on which record the user chose on the main page?
Is this possible or is there another way to go about the problem, such as jQuery/AJAX?
Ed
SGWellens
All-Star
126029 Points
10309 Posts
Moderator
Re: Changing the Web Reference URL
Feb 25, 2010 03:05 PM|LINK
A Url is hardcoded into the Web Service proxy. You can change it after you instantiate the proxy:
localhost.Service1 MyService = new localhost.Service1(); MyService.Url = "http://YourServer.com/Service1.asmx";My blog
cmsesan1
Member
469 Points
188 Posts
Re: Changing the Web Reference URL
Feb 25, 2010 04:01 PM|LINK
Thanks Steve. I have managed to get this working as follows.
Dim ws As New DataServWS.dataserv Dim strWS As String = String.Empty strWS = DirectCast(fvAccommodationDetails.Row.FindControl("litServiceAddress"), Literal).Text If strWS <> String.Empty Then ws.Url = strWS gvCalendar.DataSource = ws.GetCalendar(Date.ParseExact(txtStart.Text, "d", System.Globalization.CultureInfo.CurrentCulture)) gvCalendar.DataBind() End IfI was trying to use the ObjectDataSource linked directly to the Web service, but was not able to change the Web Reference URL that way.
Is this the best way to go about the problem though, or should I be looking at jQuery/AJAX?
Ed