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

how to get name of item from item index of rad rotator

3 Answers 159 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
saratchand
Top achievements
Rank 2
saratchand asked on 04 Dec 2010, 08:32 AM
Hi,
I'm using the rad rotator for displaying the latest 10 images by using their names from database, where the images are in a folder.
the code for above procedure is below

<telerik:RadRotator ID="RadRotator1" runat="server" Height="120px" Width="680px"  ScrollDuration="500" ScrollDirection="Right" FrameDuration="1500" ItemWidth="120px" ItemHeight="100px" RotatorType="AutomaticAdvance" DataSourceID="SqlDataSource1" OnInit="RadRotator1_Init">
 <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>


when a client clicks on the rotator item (image) it is redirecting to the new page, code for this is below

protected void RadRotator1_Init(object sender, EventArgs e)
    {
        RadRotator1.ItemClick += new RadRotatorEventHandler(RadRotator1_ItemClick);
    }
 
    void RadRotator1_ItemClick(object sender, RadRotatorEventArgs e)
    {
         
        Response.Redirect(string.Format("~/admin/postmistake.aspx",e.Item.Index));
    }

  now, in redirected page i wrote sentence as 
string s = Context.Request.QueryString["id"];

how can i get the name of image(clicked item) by using the above rotating item index

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Dec 2010, 12:00 PM
Hello,


You could pass the ImageName instead of Id as url parameter to the redirected page. Prepare the ImageUrl with "imagename" as url parameter and in the redirected page access the url parameter, which will be corresponding imagename. Hence, no need to attach ItemClick event to RadRotator.



-Shinu.
0
saratchand
Top achievements
Rank 2
answered on 06 Dec 2010, 06:43 AM
Hi,
I dint pass anytime image name in url .
Please send me some sample

Thanks for responding me
0
Shinu
Top achievements
Rank 2
answered on 10 Dec 2010, 01:03 PM
Hello,

 Please take a look at the following demo. I hope it will be helpful.
Rotator / Image Gallery

-Shinu.
Tags
General Discussions
Asked by
saratchand
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
saratchand
Top achievements
Rank 2
Share this question
or