c# - Dynamically creating Divs with Panels results in strangeness -


what do:

panel p = new panel(); p.attributes["class"] = "resultview";  foreach (string st in summary) {     panel answerpanel = new panel();     label answerlbl = new label();     answerlbl.text = theanswer;     answerpanel.controls.add(answerlbl);     answerpanel.attributes["class"] = "answer";     //answerpanel.controls.add(new literalcontrol(theanswer)); //also tried instead of label     p.controls.add(answerpanel); } 

what after 2 loops:

<div class="resultview">     <div class="answer">         <span>             <div class="externalclass10fa632a5fa34598a2540e2a29e38841">yes</div>             <div class="answer"><span>no</span></div>         </span>     </div> </div> 

what want after 2 loops:

<div class="resultview">     <div class="answer"><span>yes</span></div>     <div class="answer"><span>no</span></div> </div> 

so question why second "div class=answer" become nested in first. , why there "div class="externalclass..."? , more importantly, do make intended?

should have mentioned sharepoint project. solution this:

http://www.go4sharepoint.com/forum/externalclass-enhanced-rich-text-fields-7091.aspx

...and more explained here: http://www.sp-blogs.com/blogs/adnan/lists/posts/post.aspx?id=15.

i.e: sharepoint adds "div class="externalclass[guid]"" beginning of list items when list has 'enhanced rich text' selected text type in columns. rid of regex: regex.replace(currentitem["your field name"].tostring(), "<.*?>", string.empty);


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -