reference to htmlcontrol in webusercontrol does not work

J

Jimmy

Hi,

I have a userobject with an htmlcontrol tb1 and server control tb1. When I
try to refer to those controls from my webform
only the asp control works. The question is how to refer to the html one?

usercontrol:
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="WebUserControl2.ascx.cs"
Inherits="javascriptusercontrol.WebUserControl2"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<input id="tb1" name="tb1" type="text" value="1">
<asp:TextBox id="tb2" runat="server">2</asp:TextBox>

webform

<%@ Register TagPrefix="uc1" TagName="WebUserControl2"
Src="WebUserControl2.ascx" %>
<%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false"
Inherits="javascriptusercontrol.WebForm3" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm3</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<uc1:WebUserControl2 id="uc" runat="server"></uc1:WebUserControl2>
<input style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 56px"
onclick="javascript:if(document.Form1['uc:tb1'].value =='1')alert('got
ya!');"
type="button" value="Get value html control"> <input style="Z-INDEX:
101; LEFT: 16px; POSITION: absolute; TOP: 88px"
onclick="javascript:if(document.Form1['uc:tb2'].value =='2')alert('got
ya!');"
type="button" value="Get value asp textbox">
</form>
</body>
</HTML>

cheers

Jimmy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top