M
mc
I've developed a custom access list user control.
The control has a drop down list of people which is populated using a
sqlDataSource
Whenever I try to refrence the items in the list of people I get a null
object error.
I can refrence the control ok but in Page_Init / Page_Load /
Page_PreRender the ddlPeople.items.count == 0
If the user creates my control with the TaskTeamTaskID property set I
want to act upon the items in the drop down list during the page
initalisation.
I've included some code, I've had to retype the code so I've left bit's
out and probalbly got bits wrong but should be enough to get a feel for
what I'm doing.
My Question is when is it safe to call "init_taskTeamLists()"
-----TestPage.aspx-----
......
<uc1:UpdateTaskTeam ID="UpdateTaskTeam1" TaskTeamId="42" runat="server />
......
-----UpdateTaskTeam.ascx-----
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="UpdateTaskTeam.ascx.cs" Inherits="UpdateTaskTeam" %>
<asp:SqlDataSource ID="sdsPeople" runat="server"
SelectCommandType="StoredProcedure" SelectCommand="AllPeople"
ConnectionString="<%$ ConnectionStrings:TTT%>" />
<asp
ropDownList ID="ddlPeople" runat="server" DataSourceId="sdsPeople"
DataTextField="fullname" DataValueField="staffnumber" />
......
<asp:ListBox ID="lbReadOnly" runat="server" />
<asp:ListBox ID="lbReadWrite" runat="server" />
......
-----UpdateTaskTeam.ascx.cs-----
.......
public int TaskTeamTaskId {
get{ return Int32.Parse(hfTaskTeamTaskId.Value.ToString()); }
set{ hfTaskTeamTaskId.Value = value.ToString(); }
}
......
private void init_taskTeamLists()
{
//Do some DB stuff to get the current Task Team List
//If Person.access == Read Only
// Move from the People List to the Read Only List
//else if person.access == ReadWrite
// Move from the People List to the ReadWrite List
}
......
The control has a drop down list of people which is populated using a
sqlDataSource
Whenever I try to refrence the items in the list of people I get a null
object error.
I can refrence the control ok but in Page_Init / Page_Load /
Page_PreRender the ddlPeople.items.count == 0
If the user creates my control with the TaskTeamTaskID property set I
want to act upon the items in the drop down list during the page
initalisation.
I've included some code, I've had to retype the code so I've left bit's
out and probalbly got bits wrong but should be enough to get a feel for
what I'm doing.
My Question is when is it safe to call "init_taskTeamLists()"
-----TestPage.aspx-----
......
<uc1:UpdateTaskTeam ID="UpdateTaskTeam1" TaskTeamId="42" runat="server />
......
-----UpdateTaskTeam.ascx-----
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="UpdateTaskTeam.ascx.cs" Inherits="UpdateTaskTeam" %>
<asp:SqlDataSource ID="sdsPeople" runat="server"
SelectCommandType="StoredProcedure" SelectCommand="AllPeople"
ConnectionString="<%$ ConnectionStrings:TTT%>" />
<asp
DataTextField="fullname" DataValueField="staffnumber" />
......
<asp:ListBox ID="lbReadOnly" runat="server" />
<asp:ListBox ID="lbReadWrite" runat="server" />
......
-----UpdateTaskTeam.ascx.cs-----
.......
public int TaskTeamTaskId {
get{ return Int32.Parse(hfTaskTeamTaskId.Value.ToString()); }
set{ hfTaskTeamTaskId.Value = value.ToString(); }
}
......
private void init_taskTeamLists()
{
//Do some DB stuff to get the current Task Team List
//If Person.access == Read Only
// Move from the People List to the Read Only List
//else if person.access == ReadWrite
// Move from the People List to the ReadWrite List
}
......