This is a migrated thread and some comments may be shown as answers.

The server tag is not well formed

5 Answers 377 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
saratchand
Top achievements
Rank 2
saratchand asked on 19 Nov 2010, 12:24 PM
Hi,
 im using rad rotator for rotating latest 10 images from a folder, but the image names are in database.
So ,i have to retrieve those latest 10 image names and should attach these names to images path using image url
like this:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="120px" Width="300px">
                        <telerik:RadRotator ID="RadRotator1" runat="server" Height="120px" Width="680px" ScrollDirection="Right"
                        ItemWidth="120px" ItemHeight="100px" BorderColor="Transparent">
                       <ItemTemplate>
                          <div style="margin:5px">
                              <asp:Image ID="image1" runat="server" CssClass="image" ImageAlign="left" ImageUrl="~/images/movies/'<%#Bind("imagename")%>'"/>
                          </div>
                        </ItemTemplate>
                         </telerik:RadRotator>                        
                    </telerik:RadAjaxPanel>
check my below files to get clear view on this





pls help me out of this issue

5 Answers, 1 is accepted

Sort by
0
Accepted
Svetlina Anati
Telerik team
answered on 19 Nov 2010, 12:45 PM
Hi saratchand,

 Please, note that the problem you report is not directly related to RadControls but to general ASP.NET knowledge. The issue comes from the fact that you cannot bind the url for the image as you have done and you can reproduce the problem with another standard databound control as an asp repeater.

The correct way to bind the url is as shown below: 


<ItemTemplate>
    <div style="margin: 5px">
        <asp:Image ID="image1" runat="server" CssClass="image" ImageAlign="left" ImageUrl='<%#Bind("~/images/movies/{0}", "imagename")%>' />
    </div>
</ItemTemplate>


All the best,
Svetlina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
saratchand
Top achievements
Rank 2
answered on 19 Nov 2010, 01:13 PM
Hi Svetlina ,

  Thank you very much for responding so early
   Its working but the images in rotator are not displayed.Here i should get latest 10 images from folder into rotator by using their names which are in database
 I used this code like you said before

this is aspx file
<div id="right">
 <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="120px" Width="300px">
  <telerik:RadRotator ID="RadRotator1" runat="server" Height="120px" Width="680px" ScrollDirection="Right" ItemWidth="120px" ItemHeight="100px" BorderColor="Transparent">
   <ItemTemplate>
   <div style="margin:5px">
   <asp:Image ID="image1" runat="server" CssClass="image" ImageAlign="left" ImageUrl='<%#Bind ("~/images/movies/{0}", "imagename") %>'/>
   </div>
  </ItemTemplate>
 </telerik:RadRotator>                       
</telerik:RadAjaxPanel>
</div>

 this is aspx.cs file
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString);
SqlDataAdapter da = new SqlDataAdapter("select top 10 imagename from movie order by mid desc",conn);
  DataSet ds = new DataSet();
   da.Fill(ds,"movie");
    RadRotator1.DataSource=ds.Tables["movie"];
     RadRotator1.DataBind();


help me out of this
0
Accepted
Svetlina Anati
Telerik team
answered on 24 Nov 2010, 02:43 PM
Hello saratchand,

 Please, note that your question considers general asp.net knowledge and it is not directly related to RadControls.

Please, modify the code in the following manner:

1) Make sure the path is correct
2) Add the extension of the file as well - e.g .jpg
3) Switch the places of path and evaluated value

If the path is correct and the file is let's say .jpg, you should modify your code in a similar manner as shown below:

<asp:Image ID="image1" runat="server" CssClass="image" ImageAlign="left" ImageUrl='<%#Bind ("ProductID", "~/images/movies/{0}.jpg" %>' />

 

Sincerely yours,
Svetlina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
saratchand
Top achievements
Rank 2
answered on 25 Nov 2010, 05:24 AM
Hi Svetlina ,
 Thanks for responding to my thread. I got issue solved in two ways. one way is your replied post and other way i did is below , before to that i have another doubt.
I'm using rad rotator ,I put latest top 10 images in rotator by getting their names from database  where images are stored in a  folder.
here is code for above procedure
<telerik:RadRotator ID="RadRotator1" runat="server" Height="120px" Width="680px" ScrollDuration="500" ScrollDirection="Right"
  FrameDuration="1500" ItemWidth="120px" ItemHeight="100px" RotatorType="AutomaticAdvance" DataSourceID="SqlDataSource1">
   <ItemTemplate>
     <asp:Image ID="image1" runat="server" CssClass="image" ImageAlign="left" Visible="true"
            ImageUrl='<%# String.Format("~/upload data/movies/{0}", DataBinder.Eval(Container.DataItem, "imagename")) %>' />
                                      
   </ItemTemplate>
</telerik:RadRotator>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:cinema mistakesConnectionString %>"
       SelectCommand="SELECT TOP 10 [imagename] FROM [movie] ORDER BY [mid] DESC"></asp:SqlDataSource>

               Now , when a user click on rotating image then it should redirect to new page where some details of that image are displayed. Please tell me that "on clicking a rotating item it should redirect to new page along by passing image name as id and by using that id, I Can retrieve the details belonging to id from database".
  Tell me how to pass an id on item click from that page to other page.


 yours Sincerely,
sarat

0
Svetlina Anati
Telerik team
answered on 25 Nov 2010, 04:33 PM
Hello saratchand,

 You can handle the OnClientItemClicked event and redirect from there. As to the parameter, you can simply provide it as a query string parameter.

I want to once again point that this is standard ASP.NET knowledge and if you are not sure how to do this with the rotator, please implement the same with a standard asp repeater control (you can use a button with OnClientClick event to mimic the rotator's OnClientItemClicked event). Once you have implemented this you should use the same logic with the rotator and it will start working with it as well.

If your repeater demo works but you cannot make the things work with RadRotator, please share fully runnable code for the repeater and we will make it work in the same manner with the rotator.

Greetings,
Svetlina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Rotator
Asked by
saratchand
Top achievements
Rank 2
Answers by
Svetlina Anati
Telerik team
saratchand
Top achievements
Rank 2
Share this question
or