Using Web Service Result of Custom Type for Custom Control

 Hi there, this is my first question on the ASP.NET forums! Yay!

OK, here is the problem I am having (also blogged here:

I have a web service, which queries some data and returns the result as a SerialisableList.

This serialisable list is then used on various pages as a data source, presented in different ways.

I need to do another page, but would like to encapsulate the logic into a control (since its going to be pretty complex). I have started a control, and added the property of the type SerialisableList to set its data. This is based on the type, stored within a DLL.

Now, this is where the problem comes in, when I try to set the property of the control from within the page, based on the result of the webservice, its saying they are not of the same type, since one is WebServiceName.SerialisableList, the other is DLLName.SerialsableList. I cannot perform an explicit cast, and I want to avoic "hacking" by creating a method to "convert".

Is there something I am missing? I am a n00b to ASP.NET and appreciate any/all help I can get.

 Thanks very much,



6/9/2008 8:40:39 AM 91979 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 50


When you use customtype in the WebMethod, it will be exposed as a WSDL complex type. On the client side in a .NET application, Visual Studio .NET is smart enough to parse out the type information in the WSDL and will create a new type definition that matches what the Web service is going to return as part of the service proxy definitions.

In your case, you can the customtype that is created from proxy in your custom control. For example:

localhost.MyService service = new MyService();

localhost.MyCustomType customtype = service.GetCustomType();

For more information, see 


I hope this helps.


Thomas Sun
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
6/12/2008 3:21:19 AM

Similar Artilces:

Web Custom Control within a Web Custom Control
I was wondering if this can be done and how. I've created a simple custom control that displays a header which is my first custom control. So I'm just a baby when it comes to this.. Within the header I currently have a property for breadcrumbs which is a string. What I would like to do is have the breadcrumb property  be a Link Button List. I did find a custom control of a Link Button List which is exactly what I wanted. My question is how can/do  I include this into my custom control? Can it done? How? Please help? I'm at a lose here.   Susan You should be able to do ...

Custom Web Control inside another Custom Web Control
Hi I created a custom web control (CusWebNew) that displays some textboxes by adding them to the ControlCollection of the webcontrol. I also created a custom webcontrol (CustWebButton) that inherts from Button control, and overrided the OnClick function. When I use CustWebButton on a regular web form, it seems to function correctly. However, when I added to be part of the ControlCollection of CustWebNew, it stops to work.   Any ideas why? Thanks Hey, What do you mean by stops to work?  Explain what you are trying to do with it and what it doesn't do.Brian"Trust in the...

Use Web Custom control or Web User control?
Friends,  I have a generic aspx page and its functions which is used in many .NET web application. The generic page contains a HTML Div control, server drop down list, server buttons, server textbox and it have different server and client functions to do its tasks for calling aspx pages in web applications. My problem is I do not know whether I should make that generic page as a web user control (but this is tedious because all other application folders must store frontpage aspx and code behind files of the generic page) or as a web custom control (This seems to be good beca...

Deploying Custom Controls that use Web Services
I have a custom control that I created that simply displays data from a web service. I have it so that my content provider can put it anywhere she wants and so I do not need to write redundant code everywhere. The control is a derived control from a Label. It works great in development environment but as soon as I deploy it to a site off of my machine, it throws this error:   Server Error in '/' Application. Authentication failed because the remote party has closed the transport stream. Description: An unhandled exception occurred during the execution of the current web requ...

Custom User Controls v. Custom Web Controls
Hi! Is it better for me to begin coding my controls instead of just designing them? What would the benefits be? I meen, i seem to be able to get all i need from just putting stuff together on an ASCX file but i'm obviously missing a huge concept here... please explain! Hi, creating user controls is indeed easier than creating custom server controls because you can simply drag & drop other controls on the form, easily add events to it, ... Custom controls however are better when you want to reuse them in several other projects. I like to create custom controls for small, reusable com...

Get control type for custom control?
For basic controls (text boxes, etc.) it's relatively easy to test for their type.  but how do I reliably test for the type of a custom control?For example, I have a custom control called MyControl and would like to do something similar to this: If Me.FindControl(strControlToFind).GetType = MyControl.GetType Then ... Obviously this example doesn't work, as there is no GetType for MyControl defined.  Can I setup a Type for my control?  Or is there an easier way?  You could always try:If (TypeOf (Me.FindControl(strControlToFind)) Is MyControl) then ...

Custom composite contorl contains custom contols: controls collection gets empty (Or control get reinitialized) on postback.
Hi, I'm  developing a ASP .Net custom server control library. Where all the basic(Text,check,etc) controls are working well. I have developed an composite control which is more like a Tabular control with the basic custom controls in every cell. The problem is, this composite control reinitializes on post back. I 've added the custom controls (in CreateChildControls method) as cell.controls.add(customcontrol)  row.controls.add(cell) ; this.controls.add(row) Please give me a solution as early as possible IMXO. ASP.NET constructs and reinitializes&n...

Web Custom Control
Hi. I created 4 drop downlist controls as web custom controls, which I would either like to use seperately, or working together like a hierarchy (dependant on each other). The problem is, I need to communicate with the calling control (the web page where I dragged these controls on). When the dropdownlists are used seperately, they should return all items on a table, but when they are used together, the child dropdownlist should only return items from the table based on the selection of the parent dropdownlist just above it. Can anyone please help? Thanks. You should post this in the Build...

Add .Net Control to Web Custom Control
 I want to add .NET Control (like: TextBox, Button...) to Web Custom Control.How i can do it? Alphavn That's called a composite control -- "Mark As Answer" if my reply helped you -- Hello Guys What gunteman said, that is one approach and in most cases the right one.But its also possible to add child controls to a Control thats inherit from WebControl itself. Be sure to implement INamingContainer to that inherited Control too, thats the important point of that approach.--Microsoft MVP - Visual Developer ASP / ASP.NET-

Custom Control to Custom Control communication using event delegate mech.
I have a custom control “AddressPicker” that displays dynamic address information of a user. BY dynamic I mean based on the database call it checks how may addresses a user has and it displays it. There is a “Use this Address” button at the bottom of each address information which is generated dynamically too as a part of CreateChildControl. If a user click on this button I need to pass this information to another custom control namely “AddressConsumer” which in turn uses this information for further processing.My Controls are inherited WebCOntrol,INamingContainer I am using the event deleg... controls used in custom composite controls?
I am creating an events calendar that uses the accordion to display the events for the selected day.  The problem I'm having is that the accordion is not responding to any client side events.  I would really like to find a good "How to" article for building composite controls that incorporate an control like the accordion....

Custom Server Control Vs Web Parts, Any need for Custom Server Control
Hello I've just posted a similar question on why you need server controls when you can pre-compile usercontrols and redistribute them. I've seen lots of (usercontrol vs web part) but not much on web part vs custom server control. According to the MSDN site you can put web parts onto a normal page outside of a web part zone and they behave just like custom server controls. So, if you are creating a bunch of controls for redistribution to customer sites and/or SharePoint sites why don't you just create Web Par...

How to switch the visibility of a custom control while still get all the Javascript functionality included with that custom control?
Hello All, I have a custom DatePicker control which works well in the past non-AJAX aspx pages, and it also works in UpdatePanel as long as the initial Visible Property is set to true. But I need to set the initial Visibility to False, make it visible if user want to input a date (such as From XX Date To XX Date in a query ), and make it invisible if the user decide not to enter a date. It looks like the javascript used by the DatePicker control won’t be loaded if the initial Visible Property is set to False.  Here is the scenario: 1. Put a custom DatePicker...

User Control VB.Net x Web Custom Control
I was thinking in create a user control in VB.Net, and use it in a Asp.Net as possible? So I thought about it is gonna be better than make a Web Custom Control, so i thought again, nope... But i need to know better because a don't have a progress bar in for example.... Could Somebody tell me about??? in a reallity i know the asnwer but i would like to explain by myself... Thank's Antonio...

Web resources about - Using Web Service Result of Custom Type for Custom Control -

United States Department of Health and Human Services - Wikipedia, the free encyclopedia
The United States Department of Health and Human Services ( HHS ) is a Cabinet department of the United States government with the goal of protecting ...

Melbourne Storm, St George-Illawarra Dragons continue Emergency Services Cup
Melbourne Storm will give 1000 tickets to fire fighters and other emergency services members for their opening home game against St George-Illawarra. ...

Netflix starts blocking VPNs, proxies, and other unblocking services
... VPNs. Last week, on January 14, Netflix said that it would begin cracking down on customers who use VPNs, proxies, or other "unblocking" services ...

Bluelock Certified with Advanced Designations to Provide Cisco Powered Cloud and Managed Services
Bluelock Certified with Advanced Designations to Provide Cisco Powered Cloud and Managed Services Business Wire (press release) INDIANAPOLIS(BUSINESS ...

Uber Expands On-Demand Food Delivery Service To 10 More Cities
... the world at large can now simply order their meals from their Uber app. The ride-hailing company expanded its UberEATS meal-delivery service ...

SEPTA to suspend most service at 4 a.m.
UPPER DARBY >> Forget using SEPTA to get around at the height of the monster snow storm that is bearing down on the region.

Digitimes Research: Amazon launches Alpine chips to support its entertainment services
... in January 2015, Amazon has recently launched its Alpine family chips for front-end network and multimedia applications. The Internet service ...

IBM buys Ustream to power its new video services division
... planning to nab video livestreaming company Ustream, the deal is official. The internet broadcast outfit will join IBM's new Cloud Video Services ...

IBM Buys Ustream, Launches Cloud Video Services Unit
With its acquisition of Ustream, a provider of cloud-based video streaming services, IBM announced the launch of a new cloud video services unit. ...

General Motors Embraces The Future With Car-Sharing Service Maven
Maven, the new umbrella brand for General Motors's car-sharing efforts, points to a future in which car ownership is no longer the norm. It's ...

Resources last updated: 1/23/2016 6:56:01 AM