Link to home
Start Free TrialLog in
Avatar of R8VI
R8VI

asked on

repeater empty row

hi,

I have the code below bascially its a nested repeater inside a grid view.
The repeater brings back some images according to that particular rows id.

What i want to do is that if there are no images for a particular id then not show the repeater and its contents for that row of the grid.  
and also remove the  
<a class="prev browse left"></a> before the repeater and  <a class="next browse right"></a>
after the repeater just if there are no images for a particular id.

Please help

Thanks,

R8VI
<asp:GridView ID="GridViewOutside" runat="server" DataSourceID="SqlDataSource6" AutoGenerateColumns="false"
                    OnRowDataBound="gridviewoutside_RowDataBound">
                    <Columns>
                        <asp:TemplateField HeaderText="Year">
                            <ItemTemplate>
                                <asp:Label ID="lblDescription" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Year") %>'>></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <a class="prev browse left"></a>
                                <div class="scrollable">
                                    <div class="items">
                                        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource7">
                                            <ItemTemplate>
                                                <div class="highslide-gallery">
                                                    <a href='<%# DataBinder.Eval(Container, "DataItem.PictureName") %>' class="highslide"
                                                        onclick="return hs.expand(this)">
                                                        <img border="0" width="75px" alt="image" height="75px" src='<%# DataBinder.Eval(Container, "DataItem.PictureName")%>' />
                                                    </a>
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </div>
                                </div>
                                <a class="next browse right"></a>
                                <br clear="all" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>

Open in new window

Avatar of Robb Hill
Robb Hill
Flag of United States of America image

<div>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"            
    onitemdatabound="Repeater1_ItemDataBound">
 <HeaderTemplate>
    <table border="1" cellpadding="3" cellspacing="3">
    <tr bgcolor="blue">
    <td><b>CustomerID</b>
    </td>
    <td><b>CompanyName</b>
    </td>
    <td><b>ContactName</b>
    </td>
    <td><b>ContactTitle</b></td>
    </tr>
</HeaderTemplate>
 <ItemTemplate>
     <tr>
     <td>
        <%#DataBinder.Eval(Container.DataItem, "CustomerID")%>
     </td>
     <td>
        <%#DataBinder.Eval(Container.DataItem, "CompanyName")%>    
     </td>
     <td>
        <%#DataBinder.Eval(Container.DataItem, "ContactName")%>    
     </td>
     <td>
        <%#DataBinder.Eval(Container.DataItem, "ContactTitle")%>    
     </td>
     </tr>
 </ItemTemplate>
 <FooterTemplate>
 </table>            
 </FooterTemplate>
 
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
This is a solution for hiding items in the repeater...you would have to configure it to work for you
ASKER CERTIFIED SOLUTION
Avatar of intlaqa
intlaqa
Flag of Egypt image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Now when there is no data in the repeater control, nothing will appear.
Avatar of R8VI
R8VI

ASKER

hi intlage,

I put the div class and ids in the header and footer but the images still appear

Thanks,

R8vi
Are you sure you removed them and put them in <HeaderTemplate> of your Repeater control and closed the elements within <FooterTemplate> ? Could you please show me your code after this modification
Avatar of R8VI

ASKER

hi, yes i am sure.

I am attaching the code below

Thanks,

R8vi
<ItemTemplate>
                                <asp:Repeater ID="rptImages" runat="server" OnItemDataBound="SetDivs">
                                    <HeaderTemplate>
                                        <a class="prev browse left"></a>
                                        <div class="scrollable">
                                            <div class="items">
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Literal ID="ltrlOpen" runat="server" Visible="false" Text="<div>" />
                                        <a href='../NoPublish/Images/Advanced/<%# DataBinder.Eval(Container, "DataItem.PictureName") %>'
                                            class="highslide" onclick="return hs.expand(this)">
                                            <img border="0" width="25px" alt="image" height="25px" src='<%# DataBinder.Eval(Container, "DataItem.PictureName")%>' />
                                        </a>
                                        <asp:Literal ID="ltrlClose" runat="server" Visible="false" Text="</div>" />
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        </div> </div> <a class="next browse right"></a>
                                        <br clear="all" />
                                    </FooterTemplate>
                                </asp:Repeater>
                            </ItemTemplate>

css
a.browse  {
background:url("Images/hori_large.png") no-repeat scroll 0 0 transparent;
cursor:pointer;
display:block;
float:left;
font-size:1px;

a.disabled {
	visibility:hidden !important;		
} 	

height:30px;
margin:40px 10px;
width:30px;

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial