Datalist itemcommand design?
in my application i am using datalist to display the images, i put properties of repeatcolumn=4 and reapeatdirection=horizontal. It is displaying good when there r more than or 4 images if there r only one or two or three images the gap between images r too long. if i have only one image the image displayed in datalist in the middle of the datalist. how can i solve this problem. i think you people understand my problem this is my datalist source code... datalist width="100%"
<asp:DataList ID ="dtlstallfrind" RepeatColumns ="4" RepeatDirection="horizontal"widht=100>
<ItemTemplate >
<table width="100%" >
<tr>
<td >
<asp:ImageButton ID="imgeFrien" runat ="Server" W开发者_运维问答idth="110px" Height ="100px" CommandName ="Image" CommandArgument ='<%# Eval("userid") %>' ImageUrl ='<%# "~/Userimages/"+ Eval("myimage") %>' />
</td>
</tr>
<tr>
<td >
<asp:Label ID="lblFrieNam" runat ="Server" Font-Names ="verdana" Text ='<%# Eval("username") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
What happens when you try this?
<ItemTemplate >
<asp:ImageButton ID="imgeFrien" runat ="Server" Width="110px" Height ="100px"
CommandName ="Image" CommandArgument ='<%# Eval("userid") %>' ImageUrl ='<%#
"~/Userimages/"+ Eval("myimage") %>' />
<asp:Label ID="lblFrieNam" runat ="Server" Font-Names ="verdana" Text ='<%#
Eval("username") %>'></asp:Label>
</ItemTemplate>
Try using RepeatLayout="Flow" ItemStyle="float:left;"
and see what happens... Let me know what it does?
精彩评论