Hello
I'm trying to include a dropdownlist in my gridview and then bind data to that dropdownlist.
I have come across an error:
error CS0103: The name 'sortOrderDropDown2' does not exist in the current context at System.Web.Compilation.AssemblyBuilder.Compile()
Now i'm not sure why I get this error as my asp file clearly has a dropdown with the ID="sortOrderDropDown2"
<ItemTemplate>
<asp:DropDownList ID="sortOrderDropDown2" AutoPostBack="true" runat="server" Visible="true"> </asp:DropDownList>
</ItemTemplate>
Now here is my PageLoad code in my c# file:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//Get first/last sortOrder from XML file and display
ArrayList sortOrderArrayMax = sortOrderListMax();
int maxSortOrder = sortOrderArrayMax.Count - 1;
string sortOrderMax = sortOrderArrayMax[maxSortOrder].ToString();
sortOrderHigh.Text = sortOrderMax;
//My dropdown list using the datasource from the above arraylist - gets max value.
sortOrderDropDown2.DataSource = sortOrderArrayMax;
sortOrderDropDown2.DataBind();
ArrayList sortOrderArrayMin = sortOrderListMin();
int minSortOrder = sortOrderArrayMin.Count - 1;
string sortOrderMin = sortOrderArrayMin[minSortOrder].ToString();
sortOrderLow.Text = sortOrderMin;
binddata();
}
}
Is there any reason I get this error as it clearly is there?
Thank you