473,395 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

WebUserLibrary/Control Basics

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

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

Obviously this compiles into WebControlLibrary.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="MyWinControl2"

classid="http://localhost/WebControlLibrary1.dll#WebControlLibrary1.WCustCtr l"
height="200" width="200" style="display:inline;"
VIEWASTEXT >
</OBJECT>
</BODY>
<script>
var MyUserControl;
MyUserControl = document.getElementById('MyWinControl2');
alert("objText.Run=" + MyUserControl.Text);
</script>
</HTML>

//---
// This is the entire class file
//---
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

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

[Bindable(true),
Category("Appearance"),
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(HtmlTextWriter output)
{
output.Write(Text);
}
//---
// Class/Namespace closing brackets
//---
}
}
Nov 17 '05 #1
1 1304
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**********@sbcglobalREMOVE.net> wrote in message
news:gf********************************@4ax.com...
Hello All,
I'm just now getting to WebUserControl in WebControlLibraries and am
having some trouble. I'm missing something basic, but I can't figure
it out.

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

Obviously this compiles into WebControlLibrary.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="MyWinControl2"

classid="http://localhost/WebControlLibrary1.dll#WebControlLibrary1.WCustCtr
l" height="200" width="200" style="display:inline;"
VIEWASTEXT >
</OBJECT>
</BODY>
<script>
var MyUserControl;
MyUserControl = document.getElementById('MyWinControl2');
alert("objText.Run=" + MyUserControl.Text);
</script>
</HTML>

//---
// This is the entire class file
//---
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

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

[Bindable(true),
Category("Appearance"),
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(HtmlTextWriter output)
{
output.Write(Text);
}
//---
// 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
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...
1
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...
2
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...
5
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...
2
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
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...
14
by: chitu | last post by:
Hi pals, Hope u all of r intersted in C programming.Let start from d basics.
3
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.