C
CSharp
Hello all,
I have in my project this user control I made:
public class PollControl : System.Web.UI.UserControl
I have properties on its code-behind like:
****************************
private string _name;
private ArrayList _choices;
public string Name
{
get {return _name;}
set {_name=value;}
}
public ArrayList Choices
{
get {return _choices;}
set {_choices=value;}
}
**********************
I added the control to a webform:
<%@ Register TagPrefix="CustCtrl" TagName="Poll" Src="Poll.ascx" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="Poll.WebForm1" %>
<form id="Form1" method="post" runat="server">
<CustCtrl
oll id="id1" runat="server"
Name="ProgrammingPoll"></CustCtrl
oll>
</form>
As shown, I can assigne a value to the Name property by specifying a value
in the Name attribute in the HTML. But what if I want to programmatically
pass an ArrayList to the Choices property from the webform's code-behind?
How can I get a reference at the codebehind to the Poll control I added on
the web form HTML interface, so that I can do:
id1.Choices= arrayListXYZ;
Thanks in advance
CSharp
I have in my project this user control I made:
public class PollControl : System.Web.UI.UserControl
I have properties on its code-behind like:
****************************
private string _name;
private ArrayList _choices;
public string Name
{
get {return _name;}
set {_name=value;}
}
public ArrayList Choices
{
get {return _choices;}
set {_choices=value;}
}
**********************
I added the control to a webform:
<%@ Register TagPrefix="CustCtrl" TagName="Poll" Src="Poll.ascx" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="Poll.WebForm1" %>
<form id="Form1" method="post" runat="server">
<CustCtrl

Name="ProgrammingPoll"></CustCtrl

</form>
As shown, I can assigne a value to the Name property by specifying a value
in the Name attribute in the HTML. But what if I want to programmatically
pass an ArrayList to the Choices property from the webform's code-behind?
How can I get a reference at the codebehind to the Poll control I added on
the web form HTML interface, so that I can do:
id1.Choices= arrayListXYZ;
Thanks in advance
CSharp