如何水平绑定datalist值 [英] How to bind datalist values horizontally
本文介绍了如何水平绑定datalist值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是绑定的图像,强制转换,从数据库到数据列表的名称值..
数据列表的流量垂直到来
如何并排插入(水平)
我尝试过:
< asp:DataList ID = dtlpoliticalleaders runat < span class =code-keyword> = server BorderColor = LightGreen BorderStyle = 无
BorderWidth = 1px < span class =code-attribute> CellPadding = 3 CellSpacing = 2 字体名称 = Verdana 字体大小 = 小
< span class =code-attribute> 高度 = 750px GridLines = 无 RepeatColumns = 1 RepeatDirection = 水平 RepeatLayout = 流程
< span class =code-attribute> < span class =code-attribute> 宽度 = 600
DataKeyField = ID >
< FooterStyle BackColor = #F7DF85 ForeColor = #8C4510 / >
< ItemTemplate >
< div class = 行 >
< div class = col-md-4 >
< 表格 >
< tr >
< tr class =' tableizer-firstrow' >
<% - < h2 style ='/ * float:none; * /'>
< asp:Label ID =Label1runat =serverText ='<%#Bind(Language)%>'>< / asp:Label>< / h2> - %>
< / tr >
< < span class =code-leadattribute> td >
< a href = '<% #Eval( TrailerLink)%>' target = _ blank >
< asp:图像 ID = Image2 runat = 服务器 ImageUrl =' <% #Bind( Image)%>' 高度 = 150px
< span class =code-attribute> 宽度 = 150px / > < / a >
< / td >
< < span class =code-leadattribute> / tr >
< / table >
< / div >
< div class = col-md-4 >
< table 类 =' mytable' cellspacing =' 2' >
< tr >
< td >
< asp :标签 ID = Label11 runat = server 文字 =' <% #Bind(< span class =code-string> TrailerName)%>' > ; < / asp:Label > ;
< / td >
< / tr >
< tr >
< td < span class =code-keyword>>
<% - < asp:Label ID =Label21runat =serverText ='<%#Bind (TrailerLink)%>'>< / asp:标签> - %>
< span class =code-keyword>< asp:HyperLink ID = HyperLink1 目标 = _ blank NavigateUrl =' < span class =code-keyword> <% #Eval( TrailerLink)%>>' 文本 =' <% #Bind( TrailerLink) %>' runat = server > < / asp:HyperLink >
< ; / td >
< / tr >
< td >
< asp:标签 ID = Label29 runat = server 文字 =' <% #Bind( 投射)%>' > < / asp:标签 >
< / td >
< / table >
< / div >
< / div >
< / ItemTemplate >
< / asp:DataList >
解决方案
使用此标记
< asp:datalist id = dtlpoliticalleaders runat = server bordercolor = LightGreen border style = 无
BorderWidth = < span class =code-keyword> 1px CellPadding = 3 CellSpacing = 2 字体名称 =Verdana 字体大小 = 小 RepeatDirection = 水平 RepeatLayout = 表
高度 = 750px
宽度 = 600
DataKeyField = ID > < / asp:datalist >
使用RepeatLayout
作为表
您当前的模板为每个项目创建一个新的< div class =row>
。尝试从ItemTemplate
中移动< div class =row>
:
< div class = row >
< asp:DataList ID = dtlpoliticalleaders runat = server RepeatLayout = Flow ... >
< ItemTemplate>
< div class = col- md-4 >
...
< / / span> div >
< / ItemTemplate >
< ; / asp:DataList >
< / div >
I am binded Image,cast,name values from database to datalist..
flow of the datalist is coming vertically
how to insert side by side (horizontally)
What I have tried:
<asp:DataList ID="dtlpoliticalleaders" runat="server" BorderColor="LightGreen" BorderStyle="None"
BorderWidth="1px" CellPadding="3" CellSpacing="2" Font-Names="Verdana" Font-Size="Small"
Height="750px" GridLines="None" RepeatColumns="1" RepeatDirection="Horizontal" RepeatLayout="Flow"
Width="600"
DataKeyField="ID">
<FooterStyle BackColor="#F7DF85" ForeColor="#8C4510" />
<ItemTemplate>
<div class="row">
<div class="col-md-4">
<table>
<tr>
<tr class='tableizer-firstrow'>
<%-- <h2 style='/*float: none;*/'>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Language") %>'></asp:Label></h2>--%>
</tr>
<td>
<a href="'<%#Eval("TrailerLink") %>'" target="_blank">
<asp:Image ID="Image2" runat="server" ImageUrl='<%# Bind("Image") %>' Height="150px"
Width="150px" /></a>
</td>
</tr>
</table>
</div>
<div class="col-md-4">
<table class='mytable' cellspacing='2'>
<tr>
<td>
<asp:Label ID="Label11" runat="server" Text='<%# Bind("TrailerName") %>'></asp:Label>
</td>
</tr>
<tr>
<td>
<%--<asp:Label ID="Label21" runat="server" Text='<%# Bind("TrailerLink") %>'></asp:Label>--%>
<asp:HyperLink ID="HyperLink1" Target="_blank" NavigateUrl='<%#Eval("TrailerLink") %>>' Text='<%# Bind("TrailerLink") %>' runat="server"></asp:HyperLink>
</td>
</tr>
<td>
<asp:Label ID="Label29" runat="server" Text='<%# Bind("Cast") %>'></asp:Label>
</td>
</table>
</div>
</div>
</ItemTemplate>
</asp:DataList>
解决方案
use this markup
<asp:datalist id="dtlpoliticalleaders" runat="server" bordercolor="LightGreen" borderstyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" Font-Names="Verdana" Font-Size="Small" RepeatDirection="Horizontal" RepeatLayout="Table" Height="750px" Width="600" DataKeyField="ID"></asp:datalist>
useRepeatLayout
as "Table
"
Your current template create a new<div class="row">
for each item. Try moving<div class="row">
out of theItemTemplate
:
<div class="row"> <asp:DataList ID="dtlpoliticalleaders" runat="server" RepeatLayout="Flow" ...> <ItemTemplate> <div class="col-md-4"> ... </div> </ItemTemplate> </asp:DataList> </div>
这篇关于如何水平绑定datalist值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文