0

Ok right now the problem i have is that although i am using update panel, whenever i am updating anything within the update panel, the entire webpage would refresh.

Here is the code

 <div id="firstbar">
          <asp:UpdatePanel ID="UpdatePanel1" runat="server"  >
                <ContentTemplate>    
        <div style="width:15%;float:left;">

            <asp:Image ID="Image1" runat="server" ImageUrl="~/Img/Untitled1.png" CssClass="imagez" />

        </div>
         </ContentTemplate>

        <div style="width:85%;float:left;height:100%;padding-top:2%;">

            <asp:Label ID="Label2" runat="server" Text="CPU" CssClass="auto-style7" Font-Names="sans-serif"></asp:Label>
            <br />

            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" CssClass="bla" DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="Name" Font-Names="sans-serif" AppendDataBoundItems="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" >
    <asp:ListItem Selected="True">Pick a CPU</asp:ListItem>
    </asp:DropDownList>
            <asp:UpdatePanel ID="UpdatePanel17" runat="server">
            <ContentTemplate>

            <strong>

            <asp:Label ID="Label3" runat="server" Text="$" CssClass="auto-style8" Font-Names="sans-serif"></asp:Label>
                <asp:Label ID="Label4" runat="server" Text="0.00" CssClass="auto-style8" Font-Names="sans-serif"></asp:Label>
            </strong>

        </div>
            </ContentTemplate>
               </asp:UpdatePanel>

    </div>
Nicholas
  • 13
  • 8
  • Possible duplicate of [What is a NullReferenceException, and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – VDWWD Nov 25 '16 at 09:27
  • http://stackoverflow.com/questions/5178203/sys-webforms-pagerequestmanagerservererrorexception-status-code-500 – jignesh Nov 25 '16 at 09:33
  • Hey jignesh, i followed that link and i got an addition error Uncaught ReferenceError: Sys is not defined – Nicholas Nov 25 '16 at 10:28
  • See http://stackoverflow.com/a/40783581/5836671 – VDWWD Nov 25 '16 at 12:12

1 Answers1

0

Your Update panel contains only non-interactive controls (labels and images), while the interactive items (like the auto-postback dropdown list) are outside the update panel. Only postbacks that are initiated inside the the update panel will cause a partial postback. So you have to move those controls into the update panel. For example the drop down list:

<div style="width:85%;float:left;height:100%;padding-top:2%;">

            <asp:Label ID="Label2" runat="server" Text="CPU" CssClass="auto-style7" Font-Names="sans-serif"></asp:Label>
            <br />

            <asp:UpdatePanel ID="UpdatePanel17" runat="server">
            <ContentTemplate>
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" CssClass="bla" DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="Name" Font-Names="sans-serif" AppendDataBoundItems="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" >
    <asp:ListItem Selected="True">Pick a CPU</asp:ListItem>
    </asp:DropDownList>

            <strong>

            <asp:Label ID="Label3" runat="server" Text="$" CssClass="auto-style8" Font-Names="sans-serif"></asp:Label>
                <asp:Label ID="Label4" runat="server" Text="0.00" CssClass="auto-style8" Font-Names="sans-serif"></asp:Label>
            </strong>

        </div>
            </ContentTemplate>
               </asp:UpdatePanel>
</div>
Sefe
  • 13,731
  • 5
  • 42
  • 55
  • By doing so, i will get this error Uncaught Error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object. – Nicholas Nov 25 '16 at 10:43
  • Check the stack trace of your exception, this is the text of a `NullReferenceException` in a non-.NET excpetion. Check for the stack trace of any inner exceptions. The problem you are describing is most probably unrelated to the update panel. You will probably have to step through your event handler. – Sefe Nov 25 '16 at 10:46
  • This is the error i keep getting : at Function.Error$create [as create] (http://localhost:58930/ScriptResource.axd? – Nicholas Nov 25 '16 at 10:49