Hi all,
I am trying to add meta:resourcekey's to database programmatically
looping throug webcontrols, but i cann't read the 'meta:resourcekey'
from the webcontrol. The 'meta:resourcekey' will not show up as
attribute. How can i get the value of the 'meta:resourcekey' ?
THE CODE:
public string RetrieveControls(Control myControl){
string stringHtml = "<ul>";
foreach (Control c in myControl.Controls) {
stringHtml += "<li>";
if (c is WebControl){
// This does not work ...
// if (((WebControl)c).Attributes["meta:resourcekey"] != null){
// stringHtml += ((WebControl)c).Attributes["meta:resourcekey"];
// }
stringHtml += c.GetType().ToString() + " [" +
c.Controls.Count.ToString() + "] ";
} else {
stringHtml += "No webcontrol";
}
if (c.Controls.Count > 0)
{
stringHtml += "<ul>" + RetrieveControls(c) + "</ul>";
}
stringHtml += "</li>";
}
stringHtml += "</ul>";
return stringHtml;
}
|