views:

111

answers:

2

I want to pass a value to this JavaScript from the database (using datareader in asp.net(C#)).

The script is from http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm

I need to set a pass value in the below line:

leftrightslide[cnt] = '<a href="MYWEBPAGE"><img src="MYIMAGE FRM DATABASE.gif" border=1></a>';
cnt++;

So the value of the datareader would be passed into the JavaScript array.

A: 

You can use a webservice

Yassir
I have copied this script in my default.aspx page and my coding for datareader isobject objProd = DProducts.getAllProducts(); ProdRD = (SqlDataReader)objProd; ProdRD.Read();
Neerav Chauhan
A: 

See following:
http://www.velocityreviews.com/forums/t76971-populating-javascript-array-from-vb-net.html
Create string from serverside using datareader and register it.

OR

use RegisterArrayDeclaration(arrayName, arrayValue) from server side. See following for this:
http://msdn.microsoft.com/en-us/library/aa479302.aspx

Brij