CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 2/9/2004 9:19:24 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 62 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
mahmoud690
Asp.Net User
How to Instantiate UserControl in a web service?2/9/2004 9:19:24 AM

0/0

Hi.

I have a big problem here! . I have an System.Web.UI.UserControl that I want to use it in an webservice and the get it's advantages.
but as you know we can not pase a user control in a web service page. the only work that I can do is:
-make the control by Instantiating it (dim XX as New MyUserControl)
but it is not work becuase the HTML tags do not rendered and I can Access my server control through it. (they have Nothing ) .
please advice me , what must I do?

thanks
master4eva
Asp.Net User
Re: How to Instantiate UserControl in a web service?2/9/2004 1:45:59 PM

-1/1

There is nothing stopping you from instantiating a page which contains the user control. For example, this is your page:

public class MyWebServicedPage : Page() {
public void FireEvents() {
EventArgs e = EventArgs.Empty;

OnInit(e);
OnLoad(e);
OnPreRender(e);
}
}

And from the web service:

StringWriter tw = new StringWriter();
HtmlTextWriter writer = new HtmlTextWriter(tw);
MyWebServicedPage page = new MyWebServicedPage();

page.FireEvents();
page.RenderControl(writer);
return tw.ToString();

-- Justin Lovell
mahmoud690
Asp.Net User
Re: How to Instantiate UserControl in a web service?2/10/2004 5:47:55 PM

0/0

Hi

thanks , but it doesn't work!.
I have a server control on my user control page that it will be bind by one of user control's method.
but with your code , when I call the method , this control point to null (Nothing in VB.Net) and then it has not been istanciate correctly(or render)

fortunately I found the way :

Dim TempPage As New Page
dim myu as MyUserControl = CType(TempPage.LoadControl("/users/admins/services/MyUserControl .ascx"), MyUserControl )

TempPage.Controls.Add(myu)

it works fine!
3 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Microsoft ASP.NET: Fast & Easy Web Development Authors: Nitin Pandey, NIIT (Firm), Pages: 398, Published: 2002
MCAD/MCSD.NET: Developing and Implementing Web Applications with Visual Basic.NET and Visual Studio.NET Authors: Mike Gunderloy, Pages: 1104, Published: 2003
Pure ASP.NET: A Code-Intensive Premium Reference Authors: Robert Lair, Jason Lefebvre, Pages: 613, Published: 2002
MCAD Developing and Implementing Web Applications with Microsoft Visual C#(TM) . NET and Microsoft Visual Studio(R) . NET Exam Cram 2 (Exam Cram 70-315): Exam Cram 2, McAd Exam 70-315 Authors: Kirk Hausman, Amit Kalani, Priti Kalani, Ed Tittel, Pages: 555, Published: 2003
MCAD/MCSD: Developing and Implementing Web Applications with Visual C# and Visual Studio. NET Authors: Amit Kalani, Pages: 1164, Published: 2002
MCAD/MCSD: Developing and Implementing Windows-Based Applications with Visual Basic. Net and Visual Studio. Net Authors: Mike Gunderloy, Ed Tittel, Pages: 1109, Published: 2003
Security for Microsoft Visual Basic .NET Authors: Ed Robinson, Michael Bond, Pages: 396, Published: 2003
Distributed Data Applications with ASP.NET Authors: Alex Homer, Dave Sussman, Pages: 786, Published: 2003
ASP.NET in a Nutshell: In a Nutshell Authors: G. Andrew Duthie, Matthew MacDonald, Pages: 979, Published: 2003
Grid Computing: Making the Global Infrastructure a Reality Authors: Fran Berman, Geoffrey Fox, Anthony J. G. Hey, Pages: 1012, Published: 2003

Web:
Where best to instantiate and close a Silverlight-enabled WCF ... Or, if created as a variable of the UserControl class, is there a single place to ... How do you wait/join on a WCF Web Service called from Silverlight? ...
.NET csharp Public delegate & event not seen in parent instantiation It's a XAML UserControl that logs into a web service SOA. ... designing is a type of MDI where UserControls will be instantiated at runtime. ...
instantiate user control at runtime and set datasources : control ... asp 2.0, vb.net I need to instantiate a user control at runtime. ... Web Frameworks; Web Graphics; Web Languages/Standards; Web Servers; Web Services ...
Re: Instantiate control at runtime The problem is, I don't know until I DISPLAY the user control, how ... I am implementing a UI for a web service that is very stateful, ...
About Web Service (C#) : instantiate a new class - CodeGuru Forums About Web Service (C#) : instantiate a new class ASP. ... Apparently, a new instance of the web service class is created for each invocation ...
UserControl Component Activation in Castle MicroKernel ... how the Kernel will activate (instantiate) the web UserControl components. .... using castle windsor IOC fron nHibernmate to a webservice and I'm not ...
CodeProject: Extensible WebService and its IE-Hosted Client. Free ... Nov 2, 2003 ... CreateProcessor() loads Processor assemblies and instantiates Processor .... UserControl -based WebService consumer collaborates with the ...
calling web service method in sharepoint designer My question is how to instantiate the web service and call its method, ... I think you can develop a web part or a user control with controls to capture ...
Including a winforms user control in an asp.net web page - Peter's ... I am using web-services with usercontrols behind the SSL. On some machines the user-control does not get instantiate while working on SSL. ...
Global Object within a WebService - ASP.NET Web Services What I'm wondering, is when the Web Service is instantiated on the ... User Control Panel, Private Messages, Subscriptions, Who's Online, Search Forums ...




Search This Site:










treeview control

property nextcontrol

did they improve the treeview control for 2.0?

using controls with frontpage

win3k firewall configutation, how do i get it setup?

mfc dll or mfc activex??

include asp file in your asp.net application

looking for reliable hosting service. suggestions please.

editing webcontrol table as an htmltable

regarding development of discussion forums.

control feedback

how can i put literal content into a user control?

designer attribute not working

www.ultimahosts.net will not refund my money

newbie question: passing page variables to server control

how to create a custom dropdownlist webcontrol in c#

asp.net hosting

2 issues in builing custom controls.

help! my event bubbles are bursting!

multifile assembly server control not working in vs.net designer

increase mailbox size

image as back ground not working

resetting property values

reading a value from a dynamically loaded user control

customer datagrid user control

ie webcontrols source code

extending textbox control in asp.net

can a class know if it's being inherited?

how to create client event in a custom web control

need hosting for a photo app

  Privacy | Contact Us
All Times Are GMT