G
Guest
I am trying to assign a DataItem value into a varialble inside a repeater's
OnItemDataBound.. but keep getting this error message..
"Object reference not set to an instance of an object" what am i doing wrong?
Please help..
public void create_ddl(object s, RepeaterItemEventArgs e)
{
string categoryName =
((DataRowView)e.Item.DataItem).Row["FaultDesc"].ToString();
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
DropDownList dd = (DropDownList)e.Item.FindControl("ddl");
if(dd !=null)
{
dd.DataSource = bs.drPriority();
dd.DataTextField = "text";
dd.DataValueField = "value";
dd.DataBind();
dd.Items.FindByValue(dr["Priority"].ToString()).Selected
= true;
}
}
}
OnItemDataBound.. but keep getting this error message..
"Object reference not set to an instance of an object" what am i doing wrong?
Please help..
public void create_ddl(object s, RepeaterItemEventArgs e)
{
string categoryName =
((DataRowView)e.Item.DataItem).Row["FaultDesc"].ToString();
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
DropDownList dd = (DropDownList)e.Item.FindControl("ddl");
if(dd !=null)
{
dd.DataSource = bs.drPriority();
dd.DataTextField = "text";
dd.DataValueField = "value";
dd.DataBind();
dd.Items.FindByValue(dr["Priority"].ToString()).Selected
= true;
}
}
}