Free Jobs

Dot Net Forums: ASPNET (77) C#.NET (39) VB.NET (8) AJAX (21) Silver Light (1) WCF (10) WPF (1) WWF (1) .NET 3.5 (3) SQL SERVER (38) Other (3)

Topic: Creating horizontal slide using AJAX in ASP.NET C#

To get the Posted Questions details daily in your mail Click Here

Share this Post on Facebook/Twitter/Orkut Bookmark and Share

User: dhiraj5079 Post Date: 07 Jun 2011 07:03

Many times you need to create horizontal slide using AJAX in ASP.NET C#

Main Content:

In this post we will be using two buttons left and right to create

horizontal slide of content using using AJAX in ASP.NET C#

    <asp:ScriptManager ID="ScriptManager1" runat="server">



        <asp:UpdatePanel ID="UpdatePanel1" runat="server">


    <div style="width:250px;border-color:#D0D0D0;border-style:solid;border-width:2px;">





        <asp:LinkButton ID="LinkButtonleft" runat="server" OnClick="LinkButtonleft_Click" >

        <asp:Image ID="Image2" runat="server" ImageUrl="~/images/arrow-small-left.gif" />




        <asp:DataList ID="GList" runat="server" OnItemCommand="GList_OnItemCommand" RepeatDirection="Horizontal"  RepeatColumns="3" ItemStyle

-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top" ItemStyle-Width="70">



          <asp:Label ID="Labelid" runat="server" Text=''<%# Eval("id") %>'' Visible="false"></asp:Label>

          <asp:LinkButton ID="LinkButtonRight" runat="server" Text=''<%# Eval("Name") %>'' Font-Underline="false"  ></asp:LinkButton>







            <asp:HiddenField ID="HiddenFieldid" runat="server" Value="1"/>

             <asp:HiddenField ID="HiddenFieldEnd" runat="server" Value="1"/>

        <asp:LinkButton ID="LinkButtonRight" runat="server"  OnClick="LinkButtonRight_Click" >

        <asp:Image ID="Image3" runat="server" ImageUrl="~/images/arrow-small-right.gif" />







inside page load

         Session["dsG"] = dsG;


        HiddenFieldEnd.Value = dsG.Tables[0].Rows.Count.ToString();

        DataView dvFinal = new DataView(dsG.Tables[0], "id <=3", "id", DataViewRowState.CurrentRows);

        DataTable dtFinal = dvFinal.ToTable();


GList.DataSource = dtFinal;


protected void LinkButtonleft_Click(object sender, EventArgs e)


        int id1 = int.Parse(HiddenFieldid.Value);

        if (id1 <= 1)


            id1 = 1;




            id1 = int.Parse(HiddenFieldid.Value) - 1;


        int id2 = id1 + 2;

        BindDataGList(id1, id2);


    protected void LinkButtonRight_Click(object sender, EventArgs e)


        int id1 = int.Parse(HiddenFieldid.Value) + 1;

        int id2 = id1 + 2;

        if (id2 > int.Parse(HiddenFieldEnd.Value))


            id2 = int.Parse(HiddenFieldEnd.Value);

            id1 = id1 - 1;


        BindDataGList(id1, id2);



Thus we can create horizontal slide using AJAX in ASP.NET C#

About Writer:
Hi,I am IT Professional From Mumbai

Writer's Link: http://

Writer's Email:

Post Comment

Similar Articles Top ArticlesLatest Articles Other Articles by this Author Copyright © 2009-2011 | All Rights Reserved
All content of this website is protected by copyright laws and should not be reproduced in any form or by any means without written permission
(Best viewed in IE 8.0+ or Firefox 3.0+ at resolution of 1024 * 768 or higher)