locked
Cascading DropDown and Select2 JQ RRS feed

  • Question

  • User-1305530094 posted

    Hi All,

    I use Cascading DropDown extender to populate my DropDown list via web method and its working perfectly fine, I get my fields populated with the text that I want and I can read their ids (SQL) using my vb.net

                                    <asp:DropDownList ID="MarStatTxt" runat="server" onkeydown="return (event.keyCode!=13)"
                                        CssClass="form-control mb-md" ClientIDMode="Static">
                                    </asp:DropDownList>
    <cc1:CascadingDropDown ID="cddlMarStatTxt" runat="server"
                                                        BehaviorID="cddlMarStatTxt" Category="MarStat"
                                                        LoadingText="Loading Marital Status..." PromptText="Select Marital Status"
                                                        ServiceMethod="GetMaritalStatus"
                                                        ServicePath="~/ARTSQLAPP/CONFIG/ARTSQLWbSrvDDL.asmx"
                                                        TargetControlID="MarStatTxt" />

    once I add select2 plug in 

    <asp:DropDownList ID="MarStatTxt" runat="server" onkeydown="return (event.keyCode!=13)"
                                        data-plugin-selectTwo CssClass="form-control mb-md" ClientIDMode="Static">
                                    </asp:DropDownList>

    I can only read the text and I cant read the Id for that selected value.

    I noticed that after I select the value, my cascade DropDown extender does not read the value 

    i.e. 

    without Select 2

    <input type="hidden" name="ctl00$tst$cddlMarStatTxt_ClientState" id="tst_cddlMarStatTxt_ClientState" value="1:::Single:::">

    with select2

    <input type="hidden" name="ctl00$tst$cddlMarStatTxt_ClientState" id="tst_cddlMarStatTxt_ClientState" value="::::::">

    any idea please on how i can get this feature to work?

    thanks

    Wednesday, April 5, 2017 4:33 AM

Answers

  • User-1838255255 posted

    Hi Embryologist,

    According to your description, as far as I know, now your issue is you can not get the ID of the data through select2. 

    I am not clear why you use slelect2 with dropdownlist together. 

    About how to use select2, please refer to this sample:

    http://jsfiddle.net/jiggle/Lw2qJ/  

    Also I am not clear you how to get the ID value? I hope you could post your completed code of your project.

    Best Regards,

    Eric Du

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 6, 2017 7:11 AM