I need to get the value of the selected item in a dropdown list that's inside the edit template of a formview control. The formview ID is "fvDocRvwrs".
Here's the markup for the dropdownlist:
<asp:DropDownList SelectedValue='<%# Bind("rvwStat") %>' runat="server" ID="rvwStatDdl" CssClass="form-control" DataSourceID="sdsStatuses" DataTextField="stat" DataValueField="statIdPk" AppendDataBoundItems="true" OnSelectedIndexChanged="rvwStatDdl_SelectedIndexChanged"><asp:ListItem Value="">--Please Select--</asp:ListItem></asp:DropDownList>
I'm just having some difficulty getting the SelectedValue using the onselectedindexchanged event of the dropdownlist. I am able to find the control using:
protected void rvwStatDdl_SelectedIndexChanged(object sender, EventArgs e)
{
var statVal = fvDocRvwrs.FindControl("rwStatDdl").ToString();
}
I just need to know how to populate a variable with the selected value.