Hello guys, below my code always return value at index 0 for the dropdown list. not sure why.
try
{
BindIndicator_default();
DropDownList ddlIndicator = (DropDownList)dataGridView.HeaderRow.FindControl("ddlIndicator");
string selectedValue = ddlIndicator.SelectedValue.ToString();
if (selectedValue != "" && selectedValue != "default")
{
BindIndicator(selectedValue);
}
}
catch (Exception ex)
{
MessageBoxShow(this, ex.Message.ToString());
}
This is the aspx part
<HeaderTemplate> Indicator<br />
<asp:DropDownList name="DDList" ID="ddlIndicator" runat="server" OnSelectedIndexChanged = "DropDownList1_SelectedIndexChanged" AutoPostBack = "true" AppendDataBoundItems = "true">
<asp:ListItem Text = "Default" Value = "default"></asp:ListItem>
<asp:ListItem Text = "First 10" Value = "WIP"></asp:ListItem>
</asp:DropDownList>
</HeaderTemplate>