Hello,
I uses following code for Jquery Image gallery in My apllication
http://www.dynamicdrive.com/dynamicindex4/simplegallery.htm
In This at imagearray: function of jquery Image gallery i want to put image dynamically from server side on the base of some condition ,how can i do this
also not getting how to add image array dynamically in javascript function.
Please Suggest me.
Thanks in Advance
Omkar.
Loading
Gohil JayendrasinhPosted Jun 13, 2012, 3:17 AM
Hi
Your Aspx page like
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeBehind="Default.aspx.cs"
Inherits="SimpleControlsGallery.Default"
%>
DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>title>
<style type="text/css">
/*Make sure your page contains avalid doctype at the top*/
#simplegallery1{ //CSS
for sample Gallery
position: relative;
visibility: hidden;
border: 10px solid orange;
}
style>
<script src="Scripts/jquery-1.4.1.min.js"
type="text/javascript">script>
<script src="Scripts/simplegallery.js"
type="text/javascript">script>
<script>
var mygallery = new
simpleGallery({
wrapperid: "simplegallery1",
//ID of main gallery container,
dimensions: [250, 180], //width/height of
gallery in pixels. Should reflect dimensions of the images exactly
imagearray: <%=Imagelist %>,
autoplay: [true, 2500, 2], //[auto_play_boolean, delay_btw_slide_millisec,
cycles_before_stopping_int]
persist: false,
preloadfirst: true, //v1.4 option on whether slideshow should only start
after all images have preloaded
fadeduration: 500, //transition duration
(milliseconds)
oninit: function () { //event that fires when gallery has initialized/ ready
to run
//Keyword "this": references
current gallery instance (ie: try this.navigate("play/pause")
},
onslide: function (curslide, i) { //event that fires after each slide is shown
//Keyword "this": references
current gallery instance
//curslide: returns DOM reference tocurrent slide's DIV (ie: try alert(curslide.innerHTML)
//i: integer reflecting current imagewithin collection being shown (0=1st image, 1=2nd etc)
}
})
script>
head>
<body>
<form id="form1" runat="server">
<div id="simplegallery1">
div>
form>
body>
html>
And .cs page like
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace SimpleControlsGallery
{
public partial class Default :System.Web.UI.Page
{
private string _imagelist;
public string Imagelist
{
get { return
_imagelist; }
set { _imagelist = value;
}
}
protected void
Page_Load(object sender, EventArgs e)
{
Imagelist = "[
[\"album-af.jpg\",\"\",\"\",
\"\"],
[\"album-ag.jpg\",\"\",\"\",\"\"], [\"album-bb.jpg\",
\"\",\"\",\"\"],
[\"album-bk.jpg\",\"\", \"\",
\"\"]]";
}
}
}