I need to get items from a html list from the vb.net code behind in my asp.net web site. Any thoughts on how this can be done? I want to use the list items then in an sql statement to retrieve data from a database.
Im using javascript on the front end to handle drag and drop between these two lists:
<div class="demo">
<table>
<tr>
<td valign="top"> <ul id="All" class="connectedSortable sortable" style="border:groove" >
<input name="DEMO" type="text" style="border:hidden; display:table-cell;" value="All Products" />
<li class="ui-state-default">item1</li>
<li class="ui-state-default">item2</li>
<li class="ui-state-default">item3</li>
<li class="ui-state-default">item4</li>
<li class="ui-state-default">item5</li>
<li class="ui-state-default">item6</li>
<li class="ui-state-default">item7</li>
<li class="ui-state-default">item8</li>
<li class="ui-state-default">item9</li>
</ul>
</td>
<td valign="top"><ul id="Selected" class="connectedSortable sortable" style="border:groove">
<input name="DEMO" type="text" style="border:hidden; display:table-cell;" value="Selected Products" />
</ul></td>
</tr>
</table>
</div>
I cannot use the runat="server" option as it removes the javascript drag and drop functionality on the main page. Any help appreciated
Your question in not exactly clear for me. But if you talking about retrieving value of li
from code behind...
you have to use runat="server"
on your list
eg. <li ID="myList" runat="server">My List Item</li>
UL
runat=server
, then you can access it in codebehind as HtmlGenericControl
and get all items(as LiteralControl
) with it's Controls
-property. BulletedList
server control which has a Items
property and will be rendered as an unordered(ul) or ordered(ol) html-list. I am curious about the requirement - if this is text that you have put on the page, cannot you retrieve it from the same location in your code behind?
Anyhow, to answer the question:
You can add the same items with some delimiter to a hidden textbox and read the value of that textbox in your code behind using the delimiter to separate the items.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.