.NETGURU
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 Guru (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 Guru (http://www.dot-net-guru.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 Guru" 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




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification