C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to create a Slide Show Using WebServices


Posted Date: 14 Jun 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms

Posted By: Rumpa M       Member Level: Gold
Rating:     Points: 10



The following code sample shows how to create a Slide Show Using WebServices

//////////////code behind..........

public partial class slideshow : System.Web.UI.Page
{
private static DataTable tblData = new DataTable();
photogalary.slideshow dd = new photogalary.slideshow();

protected void Page_Load(object sender, EventArgs e)
{
dd.pro_album_id = Convert.ToInt32(Session["album"]);

tblData = dd.slide();
if (this.IsPostBack)
return;


// set the initial image
if (tblData.Rows.Count > 0)
{


for (int i = 0; i < tblData.Rows.Count; i++)
{

imgShowImage.ImageUrl = tblData.Rows[i]["pic_path"].ToString();
}

}

}

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[tblData.Rows.Count];

for (int i = 0; i < tblData.Rows.Count; i++)
{
DataRow dr = tblData.Rows[i];
slides[i] =new AjaxControlToolkit.Slide(

dr["pic_path"].ToString(),
dr["id"].ToString(),
dr["pic_name"].ToString());
}
return slides;

}
}
...........
,,,,,,,,,,,,,,,,,,,,,,,,,,
app class.........
...............................
public class slideshow
{
static string conn = ConfigurationManager.ConnectionStrings["con"].ConnectionString.ToString();
SqlConnection con = new SqlConnection(conn);

protected int album_id;
public int pro_album_id
{
get { return album_id; }
set { album_id = value; }
}



public DataTable slide ()
{

SqlDataAdapter adap = new SqlDataAdapter();
DataTable tblData1 = new DataTable();
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
SqlCommand cmd = new SqlCommand("selectpic_fromalbum", con);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add(new SqlParameter("@album_id", SqlDbType.Int));
cmd.Parameters["@album_id"].Value = pro_album_id;

adap.SelectCommand = cmd;
tblData1 = new DataTable();
adap.Fill(tblData1);
return (tblData1);
}




}
.....................source.
SlideShowServiceMethod="GetSlides"
AutoPlay="true"
ImageTitleLabelID="imageTitle"
ImageDescriptionLabelID="imageLabel1"
NextButtonID="nextButton"
PlayButtonText="Play"
StopButtonText="Stop"
PreviousButtonID="prevButton"
PlayButtonID="playButton"
Loop="true">







Responses

Author: sreelatha yalamanchi    16 Jun 2008Member Level: Silver   Points : 1
thank you very much for the code.....it was really helpful to me...keep on posting..


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Logout
Previous Resource: Code to search the elements in an XML File and display them in the Gridview
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

fax server

Contact Us    Privacy Policy    Terms Of Use