I have a DropDownList inside a repeater and whenever the selected text is changed, I have to show it in a TextBox but I’m getting Object reference not set to an instance of an object error
protected void Ddl_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = (DropDownList) sender;
RepeaterItem item = (RepeaterItem) ddl .NamingContainer;
TextBox txt = (TextBox) item.FindControl("TextBox4");
txt.Text = ddl.SelectedItem.Text;
}
Just enable Ddl dropdowns autopost back property to true and just add following line of code: