C
chaoy
Hi,
I have created a user control, and need to change the properties of
controls on the user control. However, if the form of user control are
not runat=server, I got error of "...is null or not a object". If I
have the form runat=server, I got error of "A page can have only one
server-side Form tag". For detail, please code below.
It will be greatly appreciated if anyone can give me quick reply.
Thanks.
Charles
<%@ Register TagPrefix="mintfact"
Namespace="mintFact.webServerControls" Assembly="cMenu" %>
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="WebUserControl1.ascx.cs"
Inherits="JavaInUserControl.WebUserControl1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="form11" name="form11" runat =server>
<P>
<TABLE id="Table1" style="HEIGHT: 27px" cellSpacing="1"
cellPadding="1" width="700" align="center" border="1">
<TR>
<TD align="middle">
<P align="center"><Center>
<mintfact:cMenu id="CMenu1" runat="server"
MenuData="MenuData.xml" TopMenuIsHorizontal="True"
MenuWidth="102"></mintfact:cMenu></Center>
<P></P>
</TD>
</TR>
</TABLE>
</P>
<P>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox></P>
<P></P>
<DIV style="DISPLAY: inline; WIDTH: 153px; HEIGHT: 24px"
ms_positioning="FlowLayout">above
is server control</DIV>
<P></P>
<DIV style="DISPLAY: inline; WIDTH: 153px; HEIGHT: 19px"
ms_positioning="FlowLayout">below
is a htmp control</DIV>
<P><INPUT id="hdnWidth" type="hidden" name="hdnWidth"
runat="server"></P>
<script language="javascript">
debugger;
var iWidth;
iWidth = window.screen.width;
iWidth = (iWidth - 700)/2-10;
document.form11.elements
//document.form11.TextBox1.value = iWidth;
document.form11.hdnWidth.value = iWidth;
//if (iWidth != 800)
//document.all.CMenu1.Left = 60;
//document.all.hdnWidth.value = window.screen.width
//document.all.item("servercontrol").value=sWidth;
sWidth = "try";
</script>
</form>
I have created a user control, and need to change the properties of
controls on the user control. However, if the form of user control are
not runat=server, I got error of "...is null or not a object". If I
have the form runat=server, I got error of "A page can have only one
server-side Form tag". For detail, please code below.
It will be greatly appreciated if anyone can give me quick reply.
Thanks.
Charles
<%@ Register TagPrefix="mintfact"
Namespace="mintFact.webServerControls" Assembly="cMenu" %>
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="WebUserControl1.ascx.cs"
Inherits="JavaInUserControl.WebUserControl1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<form id="form11" name="form11" runat =server>
<P>
<TABLE id="Table1" style="HEIGHT: 27px" cellSpacing="1"
cellPadding="1" width="700" align="center" border="1">
<TR>
<TD align="middle">
<P align="center"><Center>
<mintfact:cMenu id="CMenu1" runat="server"
MenuData="MenuData.xml" TopMenuIsHorizontal="True"
MenuWidth="102"></mintfact:cMenu></Center>
<P></P>
</TD>
</TR>
</TABLE>
</P>
<P>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox></P>
<P></P>
<DIV style="DISPLAY: inline; WIDTH: 153px; HEIGHT: 24px"
ms_positioning="FlowLayout">above
is server control</DIV>
<P></P>
<DIV style="DISPLAY: inline; WIDTH: 153px; HEIGHT: 19px"
ms_positioning="FlowLayout">below
is a htmp control</DIV>
<P><INPUT id="hdnWidth" type="hidden" name="hdnWidth"
runat="server"></P>
<script language="javascript">
debugger;
var iWidth;
iWidth = window.screen.width;
iWidth = (iWidth - 700)/2-10;
document.form11.elements
//document.form11.TextBox1.value = iWidth;
document.form11.hdnWidth.value = iWidth;
//if (iWidth != 800)
//document.all.CMenu1.Left = 60;
//document.all.hdnWidth.value = window.screen.width
//document.all.item("servercontrol").value=sWidth;
sWidth = "try";
</script>
</form>