c# - HyperLink text not rendered after controls are added -
i have hyperlink control text in text property.
with following code:
var link = new hyperlink(); var img = new htmlgenericcontrol("img"); img.attributes.add("src", "text.png"); link.text = "test"; link.controls.add(img); when this, image rendered inside a tag, text not rendred. there way render both image , text inside text property without throwing third control in mix?
when put controls webcontrol.controls collection, ignore have inside text. if want render both text , other child controls, should add text controls:
var link = new hyperlink(); var img = new htmlgenericcontrol("img"); img.attributes.add("src", "text.png"); link.controls.add(new literal{ text = "test"}); // line add text link.controls.add(img);
Comments
Post a Comment