Configure Update Panel to run a particular method only?
Configure Update Panel to run a particular method only?
am 12.01.2008 16:13:41 von John Kotuby
Hi all,
I have an update panel that holds only 2 listBoxes in a page surrounded by
40 other controls.
The purpose of the panel is -- select an Item in ListBox1 and update the
contents in ListBox2.
I have Autopostback="true" on ListBox1.
Even though ListBox2 is actually the only thing refreshing on the page, as
expected, I am pretty sure that a lot of the startup code to the page is
also running unneccesarily, causing a long delay.
Can someone give me a quick pointer on how to tell the page to run just the
SelectedIndexChanged code when the postback is the result of the ListBox1
within the Updatepanel?
A link to an article that targets this question would be fine.
Thanks for any help...
Re: Configure Update Panel to run a particular method only?
am 12.01.2008 18:42:41 von nothingsoriginalontheinternet
On Jan 12, 3:13 pm, "John Kotuby" wrote:
> Can someone give me a quick pointer on how to tell the page to run just the
> SelectedIndexChanged code when the postback is the result of the ListBox1
> within the Updatepanel?
"Startup code" should usually be run in a conditional block. You can
check the value of Page.IsPostBack.
-Mike Placentra II
RE: Configure Update Panel to run a particular method only?
am 14.01.2008 02:43:01 von mily242
Hi John,
Several posibilities- you could read IsInPartialRendering property of the
UpdatePanel to determine if a particular panel is being refreshed ie:
if (myPanel1.IsinparyialRendering)
{
}
or even better, use client-side ajax scripting to populate the lisbox
-- begin asp code --
Manufacturer:
Car:
-- end aspx code --
-- begin c# code beside --
[System.Web.Services.WebMethod(false)]
[System.Web.Script.Services.ScriptMethod(UseHttpGet = true)]
public static string[] GetCars(string manufacturer)
{
string[] cars = new string[10];
for (int i = 0; i < cars.Length; i++)
{
cars[i] = manufacturer + " car " + i.ToString();
}
return cars;
}
-- end c'# code beside --
or just to check eventtarget hidden field value (of course when using
UpdatePanels and ListBox1.AutoPostBack set to true):
bool list1SelectedIndexChanged =
Request[postEventSourceID] == list1.UniqueID;
hope this helps
--
Milosz
"John Kotuby" wrote:
> Hi all,
> I have an update panel that holds only 2 listBoxes in a page surrounded by
> 40 other controls.
> The purpose of the panel is -- select an Item in ListBox1 and update the
> contents in ListBox2.
> I have Autopostback="true" on ListBox1.
> Even though ListBox2 is actually the only thing refreshing on the page, as
> expected, I am pretty sure that a lot of the startup code to the page is
> also running unneccesarily, causing a long delay.
>
> Can someone give me a quick pointer on how to tell the page to run just the
> SelectedIndexChanged code when the postback is the result of the ListBox1
> within the Updatepanel?
>
> A link to an article that targets this question would be fine.
>
> Thanks for any help...
>
>
Re: Configure Update Panel to run a particular method only?
am 22.01.2008 20:52:58 von John Kotuby
Thanks Milosz,
That tuorial was very helpful. Sorry I didn't respond sooner...got
busy.
On Jan 13, 8:43=A0pm, Milosz Skalecki [MCAD]
wrote:
> Hi John,
>
> Several posibilities- you could read IsInPartialRendering property of the
> UpdatePanel to determine if a particular panel is being refreshed ie:
> if (myPanel1.IsinparyialRendering)
> {}
>
> or even better, use client-side ajax scripting to populate the lisbox
>