.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Images slideshow directly from the database( does not from save any folder).

Posted By: kavitha     Posted Date: November 18, 2010    Points:2   Category :ASP.Net
hi friends,

i want to only images slideshow directly from the database( does not from save any folder).

it is possible.


thanks .

Follow the following code:

Database Scripts
----------------


CREATE TABLE TblImages(
ImageName VARCHAR(50),
ImageTitle VARCHAR(50),
ImageDescription VARCHAR(50))

INSERT INTO TblImages VALUES('Winter.jpg','Winter','Description of Winter')
INSERT INTO TblImages VALUES('Sunset.jpg','Sunset','Description of Sunset')



Design
------


<html>
<head runat="server">
<title>Untitled Page</title>

<script runat="Server" type="text/C#">
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[2];
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("server=.;integrated security=true;database=dotnetspider");
System.Data.SqlClient.SqlDataAdapter sqlda = new System.Data.SqlClient.SqlDataAdapter("select * from TblImages", con);
System.Data.DataTable dt = new System.Data.DataTable();
sqlda.Fill(dt);
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
slides[i] = new AjaxControlToolkit.Slide("Images/" + dt.Rows[i]["ImageName"].ToString(), dt.Rows[i]["ImageTitle"].ToString(), dt.Rows[i]["ImageDescription"].ToString());
}
return (slides);
}
</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:Label ID="LblID" runat="server" Text="Label"></asp:Label><br />
<asp:Label ID="LblDescription" runat="server" Text="Label"></asp:Label><br />
<asp:Image ID="Image1" runat="server" Height="114px" Width="133px" /><br />
<asp:SlideShowExtender ID="SlideShowExtender1" runat="server" TargetControlID="Image1"
SlideShowServiceMethod="GetSlides" AutoPlay="true" ImageTitleLabelID="LblID"
ImageDescriptionLabelID="LblDescription" NextButtonID="BtnNext" PlayButtonText="Play"
StopButtonText="Stop" PreviousButtonID="BtnPrevious" PlayButtonID="BtnPlay" Loop="true">
</asp:SlideShowExtender>
<asp:Button ID="BtnPrevious" runat="server" Text="Button" />
<asp:Button ID="BtnPlay" runat="server" Text="Button" />
<asp:Button ID="BtnNext" runat="server" Text="Button" />
</div>
</form>
</body>
</html>





Responses

No response found. Be the first to respond this post
Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend