A
Andy Sutorius via DotNetMonster.com
Hi,
I am trying to wire up the dropdownlist in a datagrid and use the
onselectedindexchanged event however I am getting an "Object reference not
set to an instance of an object" error when I try to load the page. Do you
see the error?
Thanks,
Andy
<aspropDownList ID="ddlType" AutoPostBack="True"
OnSelectedIndexChanged="ddlType_SelectedIndexChanged" DataSource="<%
#BindTypeDropDown()%>" DataTextField="short_description"
DataValueField="code_value" Runat="server" />
protected System.Web.UI.WebControls.DropDownList ddlType;
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.ddlType.SelectedIndexChanged +=new EventHandler
(ddlType_SelectedIndexChanged); <--Error points to this line
}
protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Write("hurray");
}
I am trying to wire up the dropdownlist in a datagrid and use the
onselectedindexchanged event however I am getting an "Object reference not
set to an instance of an object" error when I try to load the page. Do you
see the error?
Thanks,
Andy
<aspropDownList ID="ddlType" AutoPostBack="True"
OnSelectedIndexChanged="ddlType_SelectedIndexChanged" DataSource="<%
#BindTypeDropDown()%>" DataTextField="short_description"
DataValueField="code_value" Runat="server" />
protected System.Web.UI.WebControls.DropDownList ddlType;
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.ddlType.SelectedIndexChanged +=new EventHandler
(ddlType_SelectedIndexChanged); <--Error points to this line
}
protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Write("hurray");
}