I made a user control having 4 dropdown list and I want to get their selected value in .aspx where I am referring this User Control. I use multiple options to get the selected value of ddl from User Control but each time its giving error " Object reference not set to an instance of Object". Here is code I am using
In your WebUserControl (user control) code-behind file, you could have something like this:
In WebUserControl (user control) code-behind file
public string DropDownSelectedValue
{
get
{
return dropDown.SelectedValue;
}
}
In web page where I am using that user control // Assuming I have defined usercontrol with the 'yourUserControl' ID
string selectedValue = yourUserControl.DropDownSelectedValue;