Previous Next

Thread: ASP.NET DropdownList failed in IIS 7

Last post 10-15-2008 5:03 AM by Jonathan_W. 6 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (7 items)

Sort Posts:

  • 07-23-2008, 10:58 AM

    ASP.NET DropdownList failed in IIS 7

    I am using Windows Server 2008 to deploy a website based on ASP.NET.

    This websited contains a simple "DropdownList" and a "Label", when the index of "DropdownList" is changed, the text of "Label" is changed. The codes are as follows:

    Default.aspx:

    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true"
                onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                <asp:ListItem Value="0">Disabled</asp:ListItem>
                <asp:ListItem Value="1">Enabled</asp:ListItem>
    </asp:DropDownList>
     <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

     

    Default. aspx.cs:

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
           Label1.Text = "DropdownList changes!";
    }

    It works fine using Visual Studio 2008  ASP.NET Development Center(e.g. http://localhost:2837/Default.aspx) , when the dropdownlist's index changes, the label's text changes as well.

    However, when the web application is deployed under IIS 7, error occurs.When the dropdownlist's index changes, the label's text does not change at all.

    I just using the Default Web Site->add application(Classic .NET AppPool) and where is the problem?

  • 07-24-2008, 11:30 AM In reply to

    Re: ASP.NET DropdownList failed in IIS 7

    This isn't an ASP.NET administration issue.  If you don't see any errors, you'll need to start debugging the code.  One difference between the dev server and IIS 7 is the account it runs under and that access that provides.  Test your setup with a Hello World! page, you may also not have ASP.NET configured correctly on the server.

    Jeff

    Look for Wrox's new book Professional IIS 7 in your local bookstore, or order now at Amazon.com
  • 07-24-2008, 8:51 PM In reply to

    Re: ASP.NET DropdownList failed in IIS 7

    Yes, I did debug the code. When I attach to the proecess "w3wp.exe", and add a break point to the following code:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
           Label1.Text = "DropdownList changes!";

    I found that this event did not been triggered at all. That is to say, the above method has not been invoked when I change the  index of the dropdown list in the page.

     Actually, I have tested a more complicated ASP.NET page. The conclusion I draw is that only BUTTON's clicked event and TEXTBOX's textchanged event can be triggered, while other take no effect.

  • 10-08-2008, 3:29 PM In reply to

    Re: ASP.NET DropdownList failed in IIS 7

    I also have similar problems.  DropDownList is not working under IIS7 while its ok under IIS6.

    Any ideas?
     

  • 10-09-2008, 5:03 AM In reply to

    • asidana
    • Top 200 Contributor
    • Joined on 03-20-2008, 12:02 PM
    • Posts 16

    Re: ASP.NET DropdownList failed in IIS 7

    isnt this entierly related to the browser/java script code that asp.net creates? as far as i know by using vsand writing code that writes something to the page when dropdown index changed is another way of using a simple editor to add javascript code (selectedindex.value etc) to the onchange event of select.
  • 10-09-2008, 6:19 AM In reply to

    Re: ASP.NET DropdownList failed in IIS 7

    This problems is caused by IE configuration for JavaScripts. In Windows Server 2008, the default configuration is  "disable JavaScripts" for certain kind of safety reasons.

    You need to change this Internet Explorer configuration to enable JavaScripts.

  • 10-15-2008, 5:03 AM In reply to

    Re: ASP.NET DropdownList failed in IIS 7

    Are you saying this is a setting on server side? I thought javascript was client side?

    How would enable Javascripts on Windows Server 2008 then?

Page 1 of 1 (7 items)
Page view counter