Problem: ASP.NET Custom Controls, Custom Types and Web Services

OK, so I am sat here at work doing the usual keyboard smashing when I come across a problem, any/all help would be greatly appreciated as a lot of this is new to me…

The Scenario

I need to create a custom control to present data based on the properties of a custom type. This type contains some summary properties, and a couple of internal collections of items. The presentation logic of this is to be encapsulated in its own ASP.NET control.

I have a ASP.NET web page, which will be the container for the control. This page will fetch the data for the control within the Page_Load event, when it receives the object back from the Web Service is should then pass the object to the control, which will render it.

   1: // The Custom ASP.NET Control Definition
   2: public class ListItemGridView : WebControl
   3: {
   4:  public SerializableList List
   5:   {
   6:   get { return _list; }
   7:   set { _list = value; }
   8:   }
   9: }
  10:  
  11: // Getting the Data for the Control from the Web Service
  12: Pages p = new Pages();
  13: SerializableList list = p.GetList();
  14:  
  15: // Setting the Controls Property
  16: listGrid.List = list; // Problem!

The Problem

Now, the control is designed to work with the same return type as the web service method, so they should both be talking about the same thing, however this is not the case, since the compiler is coming back saying that they are different types, because one is reporting as WebService.CustomType and the other is ControlLibrary.CustomType. So both are in essence the same type, but since the one from the web service is being described via the WSDL, its “appearing” different.

I have tried performing a manual cast, but it doesn’t like that either…

Any/all help would be greatly appreciated!

Share: digg it! | del.icio.us | Live | Technorati | Facebook

Comments

  1. I think you shoulf fenaggle the wotsit and bing the bonkit.

    when you've got it worked out, send teh codez plz kthksbye

    ReplyDelete

Post a Comment

Popular posts from this blog

GTD: Biphasic Sleep Experiment – Day 4

Privacy Online – How Much Would a “I’ll Google You” Get About You?

TDD – Getting Started with Test-Driven Development