tags:

views:

1586

answers:

1

Hi all. I was looking for a way to do Cascading dropdown without using web service and come across this link

I tried the suggestion at the bottom but i get the method 500 error. I search on this error on the web but all i can find is to increase the webservice jasonserislation size but i'm not using web service at all so i don't think that apply.

Does anyone know how to do cascading dropdown without using web service or come across a better tutorial/howto?

Thank

+3  A: 

The Cascading Dropdown control was not designed to be used without a webservice. I was was running into large problems using the control with large datasets. What I eventually ended up doing was the following:

<asp:ScriptManager ID="ScriptManager" runat="server" />
<asp:UpdatePanel ID="Panel1" runat="server" ChildrenAsTriggers="true">
    <ContentTemplate>
        <asp:DropDownList ID="ddlDropdown1" runat="server" OnSelectedIndexChanged="ddlDropdown1_IndexChanged" AutoPostBack="true" />
        <asp:DropDownList ID="ddlDropdown2" runat="server" />
    </ContentTemplate>
</asp:UpdatePanel>

protected void ddlDropdown1_IndexChanged (object sender, EventArgs e)
{
   // Do database access
   ....
   // Populate ddlDropdown2
}

This will allow you to populate as many levels of drop downs as you like. This solution does not use the Cascading Dropdown control but does give you the same effect. The 500 Error is a generic data error from AJAX and usually indicates that you are not using the [ScriptService()] decorator above the webservice class.

Scott Lance
Thank you for the tip. That's very helpful.
Jack

related questions