asp.net - Unable to access div content from C# -
i see space tags "\r\n "\r\n"
innerhtml & innertext properties , not actual content. going wrong
rendered html:
<div id="urllist" runat="server"> http://test1t.com <br></br> http://test2.com <br></br> </div>
c#:
htmlcontainercontrol list = (htmlcontainercontrol)urllist; string string1 = list.innerhtml; string string2 = list.innertext; //this didnt work either string string1 = urllist.innerhtml; string string2 = urllist.innertext;
if remember correctly have utilize controls[0]
find literal command contains text:
var div = (htmlgenericcontrol) urllist; var lit = (literalcontrol) div.controls[0]; string text = lit.text;
update: tested, works. text
:
http://test1t.com <br></br> http://test2.com <br></br>
however, have tested approach , works also.
c# asp.net
No comments:
Post a Comment