views:

1015

answers:

4

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.

+1  A: 

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"];
rahul
this is not what i am asking, i am passing querystring from firstpage"Response.Redirect("secondpage.aspx?id=" + path);" and in the second page under ajax slideshowextender web method i am using the following code to retrieve "HttpContext.Current.Request.QueryString["id"]" but this is not working.
A: 

Have a look at the thread - getting to the querystring, get request array inside a web service in net

adatapost
+1  A: 

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"];
}
Dave Ward
Right on the money! Used this to pass paths to images. +1
kirk.burleson
A: 

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:

Rose