1
I’m assigning a list to the DataSource
, and in this assignment I am concatenating the code with the company name, however, it loads the list with the first selected item.
How do I have the last record loaded preselected ?
My code is like this:
for (int i = 0; i < empresa.Count; i++)
{
empresa[i].ParEmpresa = empresa[i].ParCodigo + " - " + empresa[i].ParEmpresa;
}
ddlEmpIni.DataSource = empresa;
ddlEmpIni.DataTextField = "ParEmpresa";
ddlEmpIni.DataValueField = "ParCodigo";
ddlEmpIni.DataBind();
Have Tried?
ddlEmpIni.SelectedValue = ddlEmpIni.items[ddlEmpIni.items.count].ParCodigo
– Marconi
Thanks @Marconi already got with the company[i],Parcodigo inside the loop.
– AndreeH