Code :
foreach (HtmlGenericControl div in panelCategorieGuida.Controls.OfType<HtmlGenericControl>())
{
HiddenField hf = div.Controls.OfType<HtmlGenericControl>().LastOrDefault();
}
it says “that I can’t implicitly convert HtmlGenericControl to HiddenField”. Also if I wrote (HiddenField)div.Controls.OfType<HtmlGenericControl>().LastOrDefault() it doesnt works.
The last element of div (which is a HtmlGenericControl) is always a HiddenField element.
Why? Where am I wrong?
Shouldn’t it be like