Object reference???

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;

}

}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top