468,290 Members | 1,953 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

How use WebUserControl

Hi

I create WebUserControl and very confused when use control

For Example:

*****************************
*wuc.ascx
*****************************
<script id=clientEventHandlersJS language=javascript>
<!--

function selMap_onclick() {
//???? here is my problem
}

//-->
</script>
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="wuc.ascx.vb"
Inherits="localhost.wuc"
targetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<div id="divSelMap" runat="server">
<SELECT size="5" style="WIDTH: 100%; HEIGHT: 100%" id="selMap"
name="selMap" runat="server" language=javascript onclick="return
selMap_onclick()">
</SELECT>
</div>

*****************************
* test.aspx
*****************************
<%@ Register TagPrefix="uc1" TagName="wuc" Src="wuc.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="test.aspx.vb"
Inherits="localhost.test" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
.................................................. ....
</HEAD>
<body MS_POSITIONING="FlowLayout" topmargin="0" bottommargin="0"
leftmargin="0" rightmargin="0">
<form id="Form1" method="post" runat="server"
action="test.aspx?wuc=MapPrewiev">
<uc1:wuc id="Wuc" runat="server"></uc1:wuc>
</form>
</body>
</HTML>

*****************************
* In Internet Explorer -> ViewSource I see that:
*****************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
.................................................. ....
.................................................. ....
</HEAD>
<body MS_POSITIONING="FlowLayout" topmargin="0" bottommargin="0"
leftmargin="0" rightmargin="0">
<form name="Form1" method="post" action="test.aspx" id="Form1">
.................................................. ....
.................................................. ....
<script id=clientEventHandlersJS language=javascript>
<!--
function selMap_onclick() {
//???? here is my problem
}
//-->
</script>

<div id="Wuc_divSelMap"
style="DISPLAY:yes;Z-INDEX:99;LEFT:150px;WIDTH:200px;POSITION:absolute; TOP:20px;HEIGHT:150px;">
<select name="Wuc:selMap" id="Wuc_selMap" size="5" style="WIDTH: 100%;
HEIGHT: 100%" language="javascript" onclick="return selMap_onclick()">
<option value="Bulgaria">Bulgaria</option>
<option value="Sofia&Neighbours">Sofia&Neighbours</option>
<option value="Europa">Europa</option>
<option value="Sofia">Sofia</option>
<option value="Blagoevgrad">Blagoevgrad</option>
<option value="Burgas">Burgas</option>
<option value="Haskovo">Haskovo</option>
</select>
</div>
</form>
</body>
</HTML>

The "<SELECT>" in end source from IE have new NAME="Wuc:selMap" and
ID="Wuc_selMap"
I don`t know what i do when place WebUserControl in other page (test2.aspx)
with other "TagName=", or when I use this WebUserControl several thimes in
one page???
Nov 19 '05 #1
1 1806
Hi I know a little about this as I have created one and used it throughout my
web application. To add it to a form simply drag it from the solution
explorer to the form and position it in the desired location. To get to its'
properties, for example if you want to hide or display the control
conditionally in the vb file add something like
For Each ctrl As Control In Me.Controls
ctrl.FindControl("usercontrolname").Visible = False
Next
--
Paul G
Software engineer.
"DichkoSoft" wrote:
Hi

I create WebUserControl and very confused when use control

For Example:

*****************************
*wuc.ascx
*****************************
<script id=clientEventHandlersJS language=javascript>
<!--

function selMap_onclick() {
//???? here is my problem
}

//-->
</script>
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="wuc.ascx.vb"
Inherits="localhost.wuc"
targetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<div id="divSelMap" runat="server">
<SELECT size="5" style="WIDTH: 100%; HEIGHT: 100%" id="selMap"
name="selMap" runat="server" language=javascript onclick="return
selMap_onclick()">
</SELECT>
</div>

*****************************
* test.aspx
*****************************
<%@ Register TagPrefix="uc1" TagName="wuc" Src="wuc.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="test.aspx.vb"
Inherits="localhost.test" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
.................................................. ....
</HEAD>
<body MS_POSITIONING="FlowLayout" topmargin="0" bottommargin="0"
leftmargin="0" rightmargin="0">
<form id="Form1" method="post" runat="server"
action="test.aspx?wuc=MapPrewiev">
<uc1:wuc id="Wuc" runat="server"></uc1:wuc>
</form>
</body>
</HTML>

*****************************
* In Internet Explorer -> ViewSource I see that:
*****************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
.................................................. ....
.................................................. ....
</HEAD>
<body MS_POSITIONING="FlowLayout" topmargin="0" bottommargin="0"
leftmargin="0" rightmargin="0">
<form name="Form1" method="post" action="test.aspx" id="Form1">
.................................................. ....
.................................................. ....
<script id=clientEventHandlersJS language=javascript>
<!--
function selMap_onclick() {
//???? here is my problem
}
//-->
</script>

<div id="Wuc_divSelMap"
style="DISPLAY:yes;Z-INDEX:99;LEFT:150px;WIDTH:200px;POSITION:absolute; TOP:20px;HEIGHT:150px;">
<select name="Wuc:selMap" id="Wuc_selMap" size="5" style="WIDTH: 100%;
HEIGHT: 100%" language="javascript" onclick="return selMap_onclick()">
<option value="Bulgaria">Bulgaria</option>
<option value="Sofia&Neighbours">Sofia&Neighbours</option>
<option value="Europa">Europa</option>
<option value="Sofia">Sofia</option>
<option value="Blagoevgrad">Blagoevgrad</option>
<option value="Burgas">Burgas</option>
<option value="Haskovo">Haskovo</option>
</select>
</div>
</form>
</body>
</HTML>

The "<SELECT>" in end source from IE have new NAME="Wuc:selMap" and
ID="Wuc_selMap"
I don`t know what i do when place WebUserControl in other page (test2.aspx)
with other "TagName=", or when I use this WebUserControl several thimes in
one page???

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Mike Levin | last post: by
2 posts views Thread by Arun | last post: by
reply views Thread by Christian H | last post: by
2 posts views Thread by Oren | last post: by
2 posts views Thread by Oren | last post: by
reply views Thread by Giovanni | last post: by
reply views Thread by Klaus Jensen | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.