I have just got a CascadingDropDown from the AJAX Toolkit working with SelectedIndexChanged to redirect to a page passing a querystring of the selected value. I'm well chuffed!
However, I only got the SelectedIndexChanged event working by adding EnableEventValidation="false" to the page. The problem is the CascadingDropDown will be placed in the MasterPage of my website as a product selector.
I'm not keen on adding EnableEventValidation="false" to my MasterPage! I've looked at the ClientScriptManager.RegisterForEventValidation method on MSDN and it's gone right over my head.
What's the best thing to do? Is there a simple example of using ClientScriptManager.RegisterForEventValidation?
Cheers...
EDIT: Here's the code:
<asp:ScriptManager ID="asm" runat="server" />
<div>
Series: <asp:DropDownList ID="SeriesList" runat="server" /><br />
Printers: <asp:DropDownList ID="PrinterList" runat="server"
onselectedindexchanged="PrinterList_SelectedIndexChanged"
AutoPostBack="True" /><br />
</div>
<asp:CascadingDropDown ID="ccd1" runat="server"
ServicePath="CascadingDropdown1.cs.asmx" ServiceMethod="GetSeries"
TargetControlID="SeriesList" Category="Series"
PromptText="Select Series" />
<asp:CascadingDropDown ID="ccd2" runat="server"
ServicePath="CascadingDropdown1.cs.asmx" ServiceMethod="GetPrintersForSeries"
TargetControlID="PrinterList" ParentControlID="SeriesList" Category="Printer"
PromptText="Select Printer" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="PrinterList" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
And here's the event:
protected void PrinterList_SelectedIndexChanged(object sender, EventArgs e)
{
int printerID = Convert.ToInt32(PrinterList.SelectedValue);
System.Web.HttpContext.Current.Response.Redirect("Default.aspx?PID="+printerID);
}