Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have to use repeater control at page. I try to show images by readin image paths. Code block is like :

<table id="repeaterControl" style="margin-removed 300px">
            <tr>
                <td>
                    <asp:Repeater runat="server" ID="repeater" Visible="True">
                        <ItemTemplate>
                            <dx:ASPxImage  runat="server" ID="ASPxImage2" ImageUrl='<%# String.Format("RepeaterImages/{0}.png", Container.DataItem) %>'
                                Cursor="pointer"  ClientInstanceName='<%# "widgetButton_" + Container.DataItem %>'
                                ToolTip='<%# "Show " + Container.DataItem %>' ClientSideEvents-Click='<%# GetClientButtonClickHandler(Container) %>'>
                            </dx:ASPxImage>
                        </ItemTemplate>
                    </asp:Repeater>
                </td>
            </tr>
      </table>


When I build page and try to view page source, there is nothing at page source which repeater should be seen. Page source is seen like below:

XML
<table id="repeaterControl" style="margin-left: 300px">
               <tr>
                   <td>

                   </td>
               </tr>

    </table>


I thought that I can not read images and repeater can not be generated. My aspx page and image folder are at the same directory in project. And all images are .png extensioned.
How can I resolve this situation ?
Thanks for the replies in advance..
Posted
Comments
Sm.Abdullah 22-Feb-13 8:17am    
is it essential to use this image tag "dx:ASPxImage "
what if you use simple img Tag ?
try this one..
<img scr="<%# String.Format("RepeaterImages/{0}.png", Container.DataItem) %>"/>
no_-_namee 22-Feb-13 8:31am    
Yes, it is essential to use according to the project scenario. Also I tried your suggestion , but it doesn't work. I put repeater control in div tag like:

<pre>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server" >
<div>
<asp:Repeater runat="server" ID="repeater" Visible="True">
<itemtemplate>
<img src="<%# String.Format("RepeaterImages/{0}.png", Container.DataItem) %>" />


</div>
</form>
</body>
</html></pre>

Page source is seen like again below :

<pre><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title></head>
<body>
<form method="post" action="AppTest.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTg4MDU3NjI2N2RktnyyVekMjaGSMPUftwTz7GK8VGVArGAn36Om/O+A7i4=" />
</div>

<div>

</div>
</form>
</body>
</html>
</pre>

Did You check Your data source has records when you binding to repeater and how you binding.
 
Share this answer
 
Comments
no_-_namee 22-Feb-13 8:34am    
There is an image folder which I read them from paths'. I dont bind them , I try to read these images with string.format like seen at question. Should I bind them ? If I should ,how ?
For Example: Set your Images in Data table and then Bind this datatable to repeater.
 
Share this answer
 
Comments
no_-_namee 22-Feb-13 8:50am    
Actually ,I used a repeater control which reads image from a folder at another project. I looked from older one and control the new page,there is no difference. But it doesn't work. I couldn't understand why repeater is not seen ?
Syed Ali Raza 22-Feb-13 8:54am    
I have doubt How you using this
but you can set the Path of Images from a folder to datatable and Bind it to repeater, without binding how u using this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900