Why won't the lable update

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stevesl

    Why won't the lable update

    Simply, the lblDebug field will not update when it is assigned a value in the code behind. Why?

    -- aspx file --
    Code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="VendorCode.aspx.cs" Inherits="VendorCode" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Vendor Code</title>
        <script type="text/javascript" language="javascript">
            var ModalProgress = '<%= ModalProgress.ClientID %>';
        </script>
    </head>
    <body>
        <form id="form" runat="server">
        <div style="height: 305px">
        <table width="1024px;">
            <tr>
                <td align="center" valign="top">
                    <h1 style="text-align: center; padding-top: 25px;">
                        Vendor Code
                    </h1>
    
                    <script type="text/javascript" src="jsUpdateProgress.js"></script>		
                    <div id="ParentDiv" style="display:block; width: 800px; z-index:1">
                        <ajax:ToolkitScriptManager runat="server" ID="upLabelsScriptManager" EnablePageMethods="true" />
                        <asp:Panel ID="panelUpdateProgress" runat="server" CssClass="updateProgress">     
                            <asp:UpdateProgress ID="UpdateProg1" DisplayAfter="0" runat="server">       
                                <ProgressTemplate>         
                                    <div style="position: relative; top: 30%; text-align: center;">           
                                        <img src="http://bytes.com/images/progressBar.gif" style="vertical-align: middle" alt="Processing" width="82" height="10" />
                                        <br />
                                        Loading . . .        
                                    </div>
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                        </asp:Panel> 
                        <ajax:ModalPopupExtender runat="server" id="ModalProgress" backgroundcssclass="modalBackground" targetcontrolid="panelUpdateProgress" popupcontrolid="panelUpdateProgress" />
    
                        <asp:UpdatePanel runat="server" ID="upLabels" EnableViewState="true">
                            <ContentTemplate>
                                <table width="565px">
                                    <tr>
                                        <td style="padding-top: 20px; text-align: center;" >
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Panel runat="server" ID="pnlCode">
                                                <table>
                                                    <tr>
                                                        <td>
                                                        Code: 
                                                        <asp:TextBox ID="txtCode" runat="server" />&nbsp;&nbsp;
                                                        <asp:Button ID="btnCodeSubmit" runat="server" Text="Submit" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </asp:Panel>
                                            <asp:Panel runat="server" ID="pnlEdit">
                                                action page
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </td>
            </tr>
        </table>
        </div>
        <asp:Label ID="lblDebug" runat="server" Text="" />
        </form>
    </html>
    -- end of aspx file ---

    -- code behind ---
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class Vendor820sAcctNos : System.Web.UI.Page
    {
    
    
    
    
        protected void Page_Load(object sender, EventArgs e)
        {
    
            lblDebug.Text = "";
    
            if (IsPostBack)
            {
                if (Session.SessionID.ToString() == Session["SessionID"].ToString())
                {
                    if (txtCode.Text == "abc123")
                    {
                        lblDebug.Text = "IS-PostBack: good";
                        pnlCode.Visible = false;
                        pnlEdit.Visible = true;
                    }
                    else
                    {
                        lblDebug.Text = "IS-PostBack: bad";
                        pnlCode.Visible = true;
                        pnlEdit.Visible = false;
                    }
                }
                else
                {
                    lblDebug.Text = "IS-PostBack: SessionId bad";
                    pnlCode.Visible = true;
                    pnlEdit.Visible = false;
                }
            }
            else
            {
                Session["SessionID"] = Session.SessionID.ToString();
                Session["Code"] = "";
                lblDebug.Text = "PageLoad";
                pnlCode.Visible = true;
                pnlEdit.Visible = false;
            }
        }
    
    }
    -- end of code behind --
    Last edited by Niheel; Nov 1 '10, 09:25 PM. Reason: added code tags
Working...