M
Michelle Stone
I have a user control that I want to position anywhere I
like on my Web Form. I am able to do so in design time by
adding a style="position:absolute" to the HTML tag of the
user control dragged in from the Solution Explorer
This allowed me to move around the user control in the
Web Form, but it sticks to the top left corner when run
on Internet Explorer
I read that there is some DIV workabout. I read the
following code somewhere, but it didn't help. Note that
the tree control is placed inside a DIV tag (the .ascx
page is also included)
<taken from the .ascx.cs file>
public string Style
{
get
{
// Return the containing Panel control's
style attribute.
return this.Attributes["style"];
}
set
{
// Set the containing Panel control's
style attribute.
this.Attributes["style"] = value;
}
}
Here is the .ascx page
<%@ Register TagPrefix="iewc"
Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="ctrlChartOfAccounts.ascx.cs"
Inherits="JIS.ctrlChartOfAccounts"
TargetSchema="http://schemas.microsoft.com/intellisense/ie
5"%>
<DIV style="WIDTH: 142px; POSITION: absolute; HEIGHT:
100px" ms_positioning="GridLayout">
<iewc:TreeView id="chartOfAccountsTree" style="Z-
INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px"
runat="server" BorderColor="Black"
BackColor="#E0E0E0"></iewc:TreeView>
</DIV>
like on my Web Form. I am able to do so in design time by
adding a style="position:absolute" to the HTML tag of the
user control dragged in from the Solution Explorer
This allowed me to move around the user control in the
Web Form, but it sticks to the top left corner when run
on Internet Explorer
I read that there is some DIV workabout. I read the
following code somewhere, but it didn't help. Note that
the tree control is placed inside a DIV tag (the .ascx
page is also included)
<taken from the .ascx.cs file>
public string Style
{
get
{
// Return the containing Panel control's
style attribute.
return this.Attributes["style"];
}
set
{
// Set the containing Panel control's
style attribute.
this.Attributes["style"] = value;
}
}
Here is the .ascx page
<%@ Register TagPrefix="iewc"
Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="ctrlChartOfAccounts.ascx.cs"
Inherits="JIS.ctrlChartOfAccounts"
TargetSchema="http://schemas.microsoft.com/intellisense/ie
5"%>
<DIV style="WIDTH: 142px; POSITION: absolute; HEIGHT:
100px" ms_positioning="GridLayout">
<iewc:TreeView id="chartOfAccountsTree" style="Z-
INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px"
runat="server" BorderColor="Black"
BackColor="#E0E0E0"></iewc:TreeView>
</DIV>