0

I have an aspx page, with an asp:DropDownList (here DropDownList_AuthenticationMode). The element has a OnSelectedIndexChanged as well, and the AutoPostBack attribute set at true.

When this dropdownlist value changes, a request starts and the function Page_Load is triggered, but not the "DropDownList_AuthenticationMode_SelectedIndexChanged" one.

IsPostBack is also always false in the Page_Load function.

I tried a lot of things without having this function triggered. The end button with the OnClick attribute launches the same thing, without triggering the GetQrCode method.

Is there something I could have forgot ?

<form id="Form1" runat="server">
        <div class="rowflex" id="scrollableContent">
            <div class=stepContent>
                <div>
                    <span><asp:Literal ID="Literal_GetQrcode" runat="server"/></span>
                    <br/>
                    <br/>
                    <span><asp:Literal ID="Literal_FolderId" runat="server"/></span>
                    <br/>
                    <a href="../api/oauth/logout">Logout</a>
                    <br/>
                    <br/>
                    <span><asp:Literal ID="Literal_URL" runat="server"/></span>
                    <br/>
                    <asp:TextBox ID="TextBox_URL" runat="server" style="width: 400px; max-width: 600px"/>
                    <br/>
                    <br/>
                    <span><asp:Literal ID="Literal_AuthenticationMode" runat="server"/></span>
                    <br/>
                    <asp:DropDownList   ID="DropDownList_AuthenticationMode"  runat="server" AutoPostBack="true" onselectedindexchanged="DropDownList_AuthenticationMode_SelectedIndexChanged" style="width: 400px; max-width: 600px"></asp:DropDownList>
                    <br/>
                    <br/>
                    <span><asp:Literal ID="Literal_Domain" runat="server" Visible="false"/></span>
                    <br/>
                    <asp:TextBox ID="TextBox_Domain" runat="server" Visible="false" style="width: 400px; max-width: 600px"/><br/>
                    <br/>
                    <br/>
                    <asp:Button ID="Button_GetQrCode"  runat="server" OnClick="GetQrCode" />
                    <br/>
                    <br/>
                    <asp:label ID="Label_GetQrCodeResult" runat="server"></asp:label>
                </div>
            </div>
        </div>
    </form>

and the cs looks like this :

protected void DropDownList_AuthenticationMode_SelectedIndexChanged(object sender, EventArgs e)
{
     Literal_Domain.Visible = TextBox_Domain.Visible = (DropDownList_AuthenticationMode.SelectedItem.Text == AUTHENTICATIONMODE_NTLM);
}

I'm running out of ideas about this issue.

Thank you !

2 Answers2

0

Hum, as noted, postback will be true in these cases. (but then again, page load always fires again - so you might not care much).

What you care is that control event stub is not working. I would put in a debug.print (or console.writeline - which ever you been using).

If it fails, then cut the code out of that stub, delete it, and then in the web form designer, display the property sheet, and double click on that index changed property (or whatever it is), and you be jumped to code behind - that should re-wire up the event stub.

eg: enter image description here

So double click in the above combo drop down. It should create the event for you and you then will be jumped to the code editor. And cane then paste in the code you had before.

And ut that console write line before any other logic code in that event stub - you just want to ensure that the event does fire before you start debugging code that may not have been run or does not run in the first place.

Albert D. Kallal
  • 42,205
  • 3
  • 34
  • 51
0

The answer was not in the code !

web.config "DefaultDocument" was ignored by IIS only for postback operations... this was not targetting the aspx file.