解决方法
您可以在单独的TagBuilders中构建子元素,并将其生成的HTML放在父TagBuilder中。
以下是一个示例:A< select>具有一些< option>(示例为了简洁地去脂肪)
TagBuilder select = new TagBuilder("select"); foreach (var language in languages) // never ye mind about languages { TagBuilder option = new TagBuilder("option"); option.MergeAttribute("value",language.ID.ToString()); if (language.IsCurrent) { option.MergeAttribute("selected","selected"); } option.InnerHtml = language.Description; // And Now,the money-code: select.InnerHtml += option.ToString(); }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。