I have this peace of code which generates a dropdown menu, Unfortunately I'm running into issues because span tags are being generated at the creation of each HtmlGenericControl.
This is my code to generate the HtmlGenericControls:
string _touid = Request.QueryString["touid"];
string _group_array = Connections.isp_GET_VALUE("TRSTR", "", "", "");
string _tour_array = _group_array.Replace(" ", "");
HtmlGenericControl _ul = new HtmlGenericControl();
_ul.InnerHtml = "<ul class=\"dropdown-menu\">";
tour_holder.Controls.Add(_ul);
string[] groups = _tour_array.Split(',');
foreach (string group in groups)
{
string _tournoment_string = Connections.isp_GET_VALUE("TRNAM", group, "", "");
HtmlGenericControl _li = new HtmlGenericControl();
_li.InnerHtml = "<li><a href=\"Management.aspx?cid=" + _cid + "&touid=" + group + "\">" + _tournoment_string + "</a></li>";
tour_holder.Controls.Add(_li);
}
HtmlGenericControl _ul_ = new HtmlGenericControl();
_ul_.InnerHtml = "</ul>";
tour_holder.Controls.Add(_ul_);
Below is the HTML output:
<span><ul class="dropdown-menu"></span>
<span><li><a href="Management.aspx?cid=&touid=1">FIFA World Cup Brasil 2014 </a></li>
</span>
<span><li><a href="Management.aspx?cid=&touid=2">FIFA U-20 World Cup New Zealand 2015 </a></li></span>
<span><li><a href="Management.aspx?cid=&touid=3">FIFA Woman's World Cup Canada 2015 </a></li></span>
<span></ul></span>
</div>
How can I remove the span tag?