Consuming Controls from a Webservice
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.webservices.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

caesar hernandez via .NET 247 (VIP)
(Type your message here)

--------------------------------
From: caesar hernandez

Is it possible to return an Array of Controls that have defined events from a webservice to a consumer?

----------------------------------------
consumer:
----------------------------------------
controls = Webservice.CreateGUI()

----------------------------------------
webservice:
----------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Windows.Forms;
namespace GUIService{
    public class GUIService1 : System.Web.Services.WebService{
        [WebMethod]
        public Control[] InitializeInterface(){
            Control[] cc = new Control[1];
            Button but = new Button();
            but.Location = new System.Drawing.Point(100, 100);
            but.Name = "button2";
            but.Size = new System.Drawing.Size(128, 32);
            but.TabIndex = 0;
            but.Text = "button2";
            but.Show();
            but.Click += new System.EventHandler(this.button2_Click);

            cc[0] = but;

            return cc;
        }

        private void button2_Click(object sender, System.EventArgs e){
            MessageBox.Show("test");
        }
    }
}

I'd tried but I get a serialization error and cannot figure out the problem.

"Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface."

Any help would be great. Thanks

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>HVkbJN9iwkOOCeWOnrOHPg==</Id>
Reply to this message...
 
    
Govind (VIP)
Whatever you are returning from WebMethod shd be serializable. For that what
you can do is store cotrol name & properties as XML DataSet and sendback to
client. There can access the DataSet the can create the UI controls.

Regards,
Govind.

"caesar hernandez via .NET 247" wrote:

[Original message clipped]

Reply to this message...
 
 
System.ComponentModel.Component
System.ComponentModel.ISite
System.Data.DataSet
System.Drawing.Point
System.Drawing.Size
System.EventArgs
System.EventHandler
System.Web.Services.WebService
System.Web.UI.Control
System.Web.UI.WebControls.Button
System.Windows.Forms.Button
System.Windows.Forms.Control
System.Windows.Forms.MessageBox




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com