Hi friends, Here I am using Asp.Net Ajax SlideShowExtender Control for creating slide show of images which are stored in the database. This control which uses GetSlides() webservice for retrieving the database information. Now I want to pass a querystring to GetSlides() webservice so that the images rotate as on the value in querystring. My difficulty is how to pass querystring to this particular webservice, I tried using "HttpContext.Current.Request.QueryString["id"]" but this does not work, why? Can someone please suggest how to pass querystring to this webservice.
To pass querystring you can do something like this
http://yourpath/service.asmx?imageid=3
and to access the querystring from your web service you can do this
this.Context.Request.QueryString["imageid"];
Have a look at the thread - getting to the querystring, get request array inside a web service in net
You should use the ContextKey feature of the SlideShowExtender (see its documentation).
If your extender were declared something like the sample:
<ajaxToolkit:SlideShowExtender ID="SlideShowExtender1" runat="server"
TargetControlID="Image1"
SlideShowServiceMethod="GetSlides"
AutoPlay="true"
ImageTitleLabelID="imageTitle"
ImageDescriptionLabelID="imageDescription"
NextButtonID="nextButton"
PlayButtonText="Play"
StopButtonText="Stop"
PreviousButtonID="prevButton"
PlayButtonID="playButton"
Loop="true" />
And your GetSlides service method were declared with the contextKey parameter (careful, it's case sensitive), like this:
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public AjaxControlToolkit.Slide[] GetSlides(string contextKey)
{
// Do something with contextKey here and return the slides.
}
Then you could pass that QueryString value to the service method with code like this in your SecondPage.aspx's Page_Load.
protected void Page_Load(object sender, EventArgs e)
{
SlideShowExtender1.ContextKey = Request.QueryString["id"];
}
thank you very much for your stmt:
And your GetSlides service method were declared with the contextKey parameter (careful, it's case sensitive), like this: