Wednesday, March 21, 2012

Need help with passing params to server

Hello,

I'm new in Ajax and perhaps you can help me. Here is a very simplified code of my application

default.aspx:

<

formid="form2"runat="server">

<

asp:ScriptManagerID="ScriptManager1"runat="server"/>

<

asp:UpdatePanelID="UpdatePanel1"runat="server"></asp:UpdatePanel>

<

asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>

<

asp:AutoCompleteExtenderID="AutoCompleteExtender1"runat="server"ServiceMethod="GetResult"ServicePath="WebService.asmx"TargetControlID="TextBox1"/>

</

form>

default.aspx.cs:

protected void Page_Load(object sender, EventArgs e)

{

for (int i = 0; i < 5; i++)

{

LinkButton lb = new LinkButton();

lb.ID = i.ToString();

lb.Text = i.ToString();

UpdatePanel1.ContentTemplateContainer.Controls.Add(lb);

base.CreateChildControls();

}

}

And in WebService.asmx I need a service for AutoCompleteExtender that will return result depending on what LinkButton was pressed.

As far as I understand, there is no direct way to pass additional params to server with AutoCompleteExtender.

But perhaps there are other ways?

For example, can creating of a new custom control or using Sessions help?

You can pass additional params as querystring to the server.

ex:

AutoComplete.asmx?KEY=2

To retrieve the value in webserver use

HttpContext

.Current.Request.Params["KEY"]

This option was working with ATLAS but now its not working with Ajax 1.0

No comments:

Post a Comment