J
Joel Barsotti
testMy Custom Control doesn't has a drop down that pulls it's information
from another class that I use to get generic
here's the anotated version of what I'm doing:
public class AddressControl : System.Web.UI.WebControls.WebControl,
System.Web.UI.INamingContainer
{
protected System.Web.UI.WebControls.DropDownList state = new
DropDownList();
protected override void OnLoad(EventArgs e)
{
if (!Page.IsPostBack)
{
state.DataSource = MailingFunctions.GetStatesList();
state.DataValueField = "abr";
state.DataTextField = "name";
state.EnableViewState = true;
state.DataBind();
}
}
protected override void CreateChildControls()
{
Controls.Add(state);
}
}
implemented on page as such:
<%@ Page language="c#" Codebehind="test.aspx.cs" AutoEventWireup="false"
Inherits="StockLayouts.test1" %>
<%@ Register TagPrefix="cc1" Namespace="StockLayouts.CustomControls"
Assembly="StockLayoutsClassLib" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>test</title>
<meta content="Microsoft Visual Studio 7.0" name=GENERATOR>
<meta content=C# name=CODE_LANGUAGE>
<meta content=JavaScript name=vs_defaultClientScript>
<meta content=http://schemas.microsoft.com/intellisense/ie5
name=vs_targetSchema>
</head>
<body MS_POSITIONING="FlowLayout">
<form id=test method=post runat="server"><asp:label id=myLabel
runat="server"></asp:label>
<hr width="100%">
<cc1:addresscontrol id=testAddress runat="server"></cc1:addresscontrol><br>
<asp:button id="myButton" text="Submit Info"
runat="server"></asp:button></form><br >
<a href="/test.aspx">click here</a>
</body>
</html>
from another class that I use to get generic
here's the anotated version of what I'm doing:
public class AddressControl : System.Web.UI.WebControls.WebControl,
System.Web.UI.INamingContainer
{
protected System.Web.UI.WebControls.DropDownList state = new
DropDownList();
protected override void OnLoad(EventArgs e)
{
if (!Page.IsPostBack)
{
state.DataSource = MailingFunctions.GetStatesList();
state.DataValueField = "abr";
state.DataTextField = "name";
state.EnableViewState = true;
state.DataBind();
}
}
protected override void CreateChildControls()
{
Controls.Add(state);
}
}
implemented on page as such:
<%@ Page language="c#" Codebehind="test.aspx.cs" AutoEventWireup="false"
Inherits="StockLayouts.test1" %>
<%@ Register TagPrefix="cc1" Namespace="StockLayouts.CustomControls"
Assembly="StockLayoutsClassLib" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>test</title>
<meta content="Microsoft Visual Studio 7.0" name=GENERATOR>
<meta content=C# name=CODE_LANGUAGE>
<meta content=JavaScript name=vs_defaultClientScript>
<meta content=http://schemas.microsoft.com/intellisense/ie5
name=vs_targetSchema>
</head>
<body MS_POSITIONING="FlowLayout">
<form id=test method=post runat="server"><asp:label id=myLabel
runat="server"></asp:label>
<hr width="100%">
<cc1:addresscontrol id=testAddress runat="server"></cc1:addresscontrol><br>
<asp:button id="myButton" text="Submit Info"
runat="server"></asp:button></form><br >
<a href="/test.aspx">click here</a>
</body>
</html>