I've the code below where I dynamically give the div a value for the attribute "data-order". I'd like be able to grab this value with c# from the code behind file, but I unfortunately cant figure out how to do it.
<asp:ListView ID="display_backlog" runat="server" DataSourceID="get_backlog" DataKeyNames="story_id">
<EmptyDataTemplate>
<p>There is no stories in the product backlog for this project.</p>
</EmptyDataTemplate>
<ItemTemplate>
<div class="row" CssClass="sortable-item" runat="server" data-order="" data-id='<%# Eval("story_id") %>'>
<div class="col-12">
<div class="panel">
<p><asp:Label Text='<%# Eval("story_title") %>' runat="server" ID="story_titleLabel" /></p>
</div>
</div>
</div>
</ItemTemplate>
<LayoutTemplate>
<div runat="server" id="itemPlaceholderContainer" style=""><span runat="server" id="itemPlaceholder" /></div>
<div style="">
</div>
</LayoutTemplate>
</asp:ListView>
Any help would be appreciated.
One possibility is to add a hidden input server control to the page and to set the value of that hidden input dynamically when you set the value of the "data-order" attribute. You can then get the value of the hidden input easily from the code behind (because it's a server control) whenever you submit the form, as long as the hidden server control is in the form.
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.