473,657 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebUserLibrary/Control Basics

Hello All,
I'm just now getting to WebUserControl in WebControlLibra ries and am
having some trouble. I'm missing something basic, but I can't figure
it out.

I have a web control library project (WebControlLibr ary1) which
contains a single control (WCustCtrl) which is just the template from
the IDE designer.

Obviously this compiles into WebControlLibra ry.dll without problem. I
can use this control in my ASPX pages with out any trouble, but I can
not seem to use this in my generic HTML page.

I'm not sure if the problem is how I'm calling the object or if I'm
missing something in my class. Is it even possible to use this class
from a generic HTML page?

Any help would be appreciated.

-tomas
Here's what I have for the HTML page:
<HTML>
<HEAD>
</HEAD>
<BODY>
<OBJECT
id="MyWinContro l2"

classid="http://localhost/WebControlLibra ry1.dll#WebCont rolLibrary1.WCu stCtrl"
height="200" width="200" style="display: inline;"
VIEWASTEXT >
</OBJECT>
</BODY>
<script>
var MyUserControl;
MyUserControl = document.getEle mentById('MyWin Control2');
alert("objText. Run=" + MyUserControl.T ext);
</script>
</HTML>

//---
// This is the entire class file
//---
using System;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Componen tModel;

namespace WebControlLibra ry1
{
/// <summary>
/// Summary description for WCustCtrl.
/// </summary>
[DefaultProperty ("Text"),
ToolboxData("<{ 0}:WCustCtrl runat=server></{0}:WCustCtrl>" )]
public class WCustCtrl : System.Web.UI.W ebControls.WebC ontrol
{
private string text = "InitText";

[Bindable(true),
Category("Appea rance"),
DefaultValue("" )]
public string Text
{
get
{
return text;
}
set
{
text = value;
}
}

/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlText Writer output)
{
output.Write(Te xt);
}
//---
// Class/Namespace closing brackets
//---
}
}
Nov 17 '05 #1
1 1312
Tomas

A generic HTML page will not be able to use this, or any other .Net
component.

HTML pages, unless directed otherwise (settings in IIS) are not run through
the aspnet dll. They are only delivered to the client via IIS, not ASP.NET.

It sounds like you are already using it correctly through the .aspx pages.

Mark
"Tomas Vera" <ta**********@s bcglobalREMOVE. net> wrote in message
news:gf******** *************** *********@4ax.c om...
Hello All,
I'm just now getting to WebUserControl in WebControlLibra ries and am
having some trouble. I'm missing something basic, but I can't figure
it out.

I have a web control library project (WebControlLibr ary1) which
contains a single control (WCustCtrl) which is just the template from
the IDE designer.

Obviously this compiles into WebControlLibra ry.dll without problem. I
can use this control in my ASPX pages with out any trouble, but I can
not seem to use this in my generic HTML page.

I'm not sure if the problem is how I'm calling the object or if I'm
missing something in my class. Is it even possible to use this class
from a generic HTML page?

Any help would be appreciated.

-tomas
Here's what I have for the HTML page:
<HTML>
<HEAD>
</HEAD>
<BODY>
<OBJECT
id="MyWinContro l2"

classid="http://localhost/WebControlLibra ry1.dll#WebCont rolLibrary1.WCu stCtr
l" height="200" width="200" style="display: inline;"
VIEWASTEXT >
</OBJECT>
</BODY>
<script>
var MyUserControl;
MyUserControl = document.getEle mentById('MyWin Control2');
alert("objText. Run=" + MyUserControl.T ext);
</script>
</HTML>

//---
// This is the entire class file
//---
using System;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Componen tModel;

namespace WebControlLibra ry1
{
/// <summary>
/// Summary description for WCustCtrl.
/// </summary>
[DefaultProperty ("Text"),
ToolboxData("<{ 0}:WCustCtrl runat=server></{0}:WCustCtrl>" )]
public class WCustCtrl : System.Web.UI.W ebControls.WebC ontrol
{
private string text = "InitText";

[Bindable(true),
Category("Appea rance"),
DefaultValue("" )]
public string Text
{
get
{
return text;
}
set
{
text = value;
}
}

/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlText Writer output)
{
output.Write(Te xt);
}
//---
// Class/Namespace closing brackets
//---
}
}

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
15099
by: Tom Meuzelaar | last post by:
Hello: I'm using VB6 in VS enterprise. I'd like to place an HTML form inside a VB container, have a user fill out the form information, click a submit button, and then have the program capture the field values and write them to an ASCII file on the hard drive. Can anyone confirm that this is even possible? I have dredged up one article "Accessing the Internet Explorer Document Object Model from Visual Basic 5.0" (Asmi, 1998) that covers...
1
2274
by: manish | last post by:
Hi, I am a fresher in the programming field i.e although I have done programming at the basic level but at professional level I am very new and I am facing many problems. These probllems are not taughtand I am not getting any Refrences to cope with them. ********Setting in VC++ 6.0 I don'know to apply setting for various/different projects. I am not getting basics out of it .Can u pls tell me how to make a good understanding of...
2
10181
by: Dee | last post by:
I have a form which contains basics of a customer's order from table . I placed a tab control on this form which is still empty. I'm trying to design a project management database and would like to enter one form for each sub project on each tab page. ...=>
5
1369
by: charliewest | last post by:
When programming for a windows application, i can create a Control object, and then use this object to iterate through a window form's controls. For example: foreach(Control ctr in this.Controls) { // do something... } However, i am unable to create a Control object in ASP.NET. I am forced to
2
341
by: Kurien Baker Fenn | last post by:
I would like to show the progress of an application using the progress bar in visual basics using the timer.Please help me. Thanks in advance.
8
6073
by: Penny | last post by:
(Access 2003 Multiuser Split DB, Windows XP Pro) Hi All, I would really appreciate just some basic tips on how to make a Crosstab Form based on a Crosstab Query. The query always has the same number of records(generated from a table of predefined 'timeslots'). The number of columns(one for each Consultant) varies depending on how many of the Consultants have a yes/no field('Participates') set to yes. Therefore the Crosstab query...
14
2271
by: chitu | last post by:
Hi pals, Hope u all of r intersted in C programming.Let start from d basics.
3
1985
Mague
by: Mague | last post by:
Hey, I need help to some how open a exe file with Microsoft Visual basics. You mite think im trying to steal someone elses project but im not i wont to no how they did it and upgrade it if possible. I can install other programs if needed also i have got Microsoft Visual Basics Express Edition 6 Also please don't Call me a noob (i no i em) Also im onnly 13 so i have learned completly of the internet! Ty Mague!
0
3229
by: babu8880 | last post by:
www.convensysglobal.com/elearn You can login and attend courses and similar resources ask your doubts from experienced engineers in iphone and Objective C Domain You can attend live classes through our website with experienced teachers available world wide. Some among you can also be teachers while others will be your students. This is fun and adds knowledge in the domain of i-Phone Development. We request all users to be active in...
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.