webforms - asp.net listview with two rows in grouptemplate -


first question on s.o.

i have search result page in asp.net , have problems - have (for each "box") image of book cover , title of book

knowing images aren't same height, want able vertically align them bottom. searched hard on web , found solution using display table/table-row/table-cell.

everything works fine, using listview's grouptemplate (as row) , itemtemplate (as cell) if want display images - - want images vertically aligned bottom , book's title below (with link "learn more" below title).

knowing couldn't put book title in same cell image (because sometime title take 2 lines, break design again...), think need row (like in code below). tought putting 2 rows in grouptemplate work listview doesn't seem give me hability call 2 different itemtemplates (one image , 1 text placed in row, below image).

any appreciated , if have other alternatives, i'm opened suggestions. bear in mind need datapager listview- think - way go.

here's css

#grid{ background: lightgreen; border-spacing: 10px; display: table; } #grid .row{display: table-row;} #grid .result{ display: table-cell; vertical-align: bottom; } 

here's search result listview draft (image good, crappy "test" text)

<asp:listview id="lvsearchresults" runat="server" onpagepropertieschanged="datapager_prerender" onpagepropertieschanging="datapager_prerendering" groupitemcount="5" > <layouttemplate> <div id="grid"> <asp:placeholder id="groupplaceholder" runat="server" /> </div> </layouttemplate> <grouptemplate> <div class="row"> <asp:placeholder id="itemplaceholder" runat="server" /> </div> <div class="row"> <asp:placeholder id="itemplaceholder1" runat="server" /> </div> </grouptemplate> <itemtemplate> <div class="result"> <p><a href='<%# container.dataitem.uri %>'><img src='<%# container.dataitem.lesimages.petite %>' alt="" /></a></p> </div> </itemtemplate> <itemtemplate> <div class="result"> <p><a href='<%# container.dataitem.uri %>'>test</a></p> </div> </itemtemplate> </asp:listview> 

thanks lot, - eric

somehow i've been able wanted:

by giving fixed height remaining content (title , link), images continues vertically aligned. in particular case, no need create second row in grouptemplate.

fixed height title because can take (but not more) 2 lines or 1 line. since link below title same every itemtemplate itteration, no need specify height block.

thanks majob answer, somehow didn't work me.

here new , improved code... ;)

 <grouptemplate> <div class="row"> <asp:placeholder id="itemplaceholder" runat="server" /> </div> </grouptemplate> <itemtemplate> <div class="result"> <a href='<%# container.dataitem.uri %>'><img src='<%# container.dataitem.lesimages.petite %>' alt="" /></a> <div style="height: 40px;margin-top: 10px;"><asp:literal id="littitre" runat="server" text='<%# trunkstringrelay(container.dataitem.titre, 40) %>' /></div> <a href='<%# container.dataitem.uri %>'>en savoir plus &raquo;</a> </div> </itemtemplate> 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -