I have a problem that seems so simple to fix but I cannot figure out why this is not working. I have done this in other apps with no problem.

I have an ASPX page that displays data at the top for info only and a Gridview to show related records that can be edited. I use ASP:LABELs to display the data fields at the top of the page. The Code Behind handles retrieving the data during Page Load. What I am getting is the field legend with no data. I have tried everything I know and have tried everything I can Google. The code below shows that I have removed all the data fields and reduced it to a variable (m) that gets set in the Code Behind to "StuffToShow". The resulting page should show

"Case Number: StuffToShow" but only shows "Case Number: "

I cannot figure out why it is doing this. You can see in the areas commented out that I tried other things with no luck. The attached code is not complete and includes only what I thought is relevant to keep it short.

Any ideas or suggestions will be much appreciated. There has got to be a simple reason for this not working that I just cannot see.

Thank you!!!

Below is the code

<%@ Page Language="C#" MasterPageFile="~/SiteMaster.master"   AutoEventWireup="false" CodeFile="DisplayDerivativesDetail.aspx.cs" Inherits="DisplayDerivativesDetail" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageHeading" Runat="Server">
        <h3>Monthly Derivatives - Display Detail</h3>
 </asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="PageContent" Runat="Server">

    <div id="main">
         <asp:Label ID="lblInstructions" runat="server" Text="Display Detail Information:" >
        </asp:Label><br /><br />

        <!-- drop down list for detail status -->
        <asp:Label ID="lblStatus" runat="server" Text="Detail Status:" Width="80px" ></asp:Label>
        <asp:DropDownList ID="ddlStatus" runat="server" Width="75px">
            <asp:ListItem Text="Active" Selected="True" Value="AC" />
            <asp:ListItem Text="Inactive"  Value="IN" />
        </asp:DropDownList><br /><br />  

        <asp:Label ID="Label1" runat="server" Text="Case Number:" ></asp:Label>   
        <asp:Label ID="m" runat="server" ></asp:Label><br /><br />
        <!-- <asp:Label ID="Label2" runat="server" Text="NCP Name: "></asp:Label>   
        <asp:Label ID="lblNCPName" runat="server" Text="Data"  Width="280px"></asp:Label>
        <br />
        <asp:Label ID="Label3" runat="server" Text="Court Number: " Width="125px"></asp:Label>   
        <asp:Label ID="lblCourtNumber" runat="server" Width="125px"></asp:Label>
        <asp:Label ID="Label4" runat="server" Text="Monthly Amount: " ></asp:Label>   
        <asp:Label ID="lblMonthlyAmt" runat="server" Width="125px"></asp:Label>
        <br />
        <asp:Label ID="Label5" runat="server" Text="Start Date: " ></asp:Label>   
        <asp:Label ID="lblStartDate" runat="server" Width="125px"></asp:Label>
        <asp:Label ID="Label6" runat="server" Text="Review Date: "></asp:Label>   
        <asp:Label ID="lblReviewDate" runat="server" Width="125px"></asp:Label>
        <asp:Label ID="Label7" runat="server" Text="End Date: "></asp:Label>   
        <asp:Label ID="lblEndDate" runat="server" Width="125px"></asp:Label>
        <br /><br /> -->

        <!-- grid of Detail records for a selected Case  -->
        <asp:GridView ID="gvDetail" Runat="server" 
                 AllowPaging="True" AllowSorting="True" 
                 AutoGenerateEditButton="True" 
                 AutoGenerateColumns="False" 
                 BackColor="LightGray" 
                 BorderColor="#3366CC" 
                 BorderStyle="None" 
                 BorderWidth="1px"
                 CellPadding="4"  
                 DataKeyNames="CaseID" 
                 DataSourceID="odsDetail" 
                 Font-Size="X-Small"
                 OnRowEditing="gvDetail_RowEditing"
                 PagerSettings-Mode="Numeric" 
                 ShowFooter="True" > 
                <FooterStyle CssClass="HeaderFooter"></FooterStyle>
                <HeaderStyle Font-Bold="True" Wrap="True" CssClass="HeaderFooter"></HeaderStyle>
                <AlternatingRowStyle Font-Bold="False" BackColor="GhostWhite"></AlternatingRowStyle>
                <Columns>

                <asp:BoundField DataField="PaymentDate" HeaderText="Payment Date" SortExpression="PaymentDate" ItemStyle-Wrap="false" />
                <asp:BoundField DataField="Amount" HeaderText="Payment Amt" SortExpression="Amount" ItemStyle-Wrap="false" />
                <asp:BoundField DataField="DetailComment" HeaderText="Comment" SortExpression="DetailComment" ItemStyle-Wrap="false" />
                <asp:BoundField DataField="DetailAddedBy" HeaderText="Added By" SortExpression="DetailAddedBy" ItemStyle-Wrap="false" />
                <asp:BoundField DataField="DetailAdded" HeaderText="Added" SortExpression="DetailAdded" ItemStyle-Wrap="false" />
                <asp:BoundField DataField="DetailUpdatedBy" HeaderText="Updated By" SortExpression="DetailUpdatedBy" ItemStyle-Wrap="false" />
                <asp:BoundField DataField="DetailUpdated" HeaderText="Updated" SortExpression="DetailUpdatedBy" ItemStyle-Wrap="false" />

                <asp:TemplateField HeaderText="Detail ID" SortExpression="DetailID" visible="false">
                    <EditItemTemplate>
                        <asp:TextBox ID="eitDetailID" runat="server" ReadOnly="True" Text='<%# Bind("DetailID") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="itDetailID" runat="server" Text='<%# Bind("DetailID") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Case ID" SortExpression="CaseID" visible="false">
                    <EditItemTemplate>
                        <asp:TextBox ID="eitCaseID" runat="server" ReadOnly="True" Text='<%# Bind("CaseID") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="itCaseID" runat="server" Text='<%# Bind("CaseID") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Wrap="False" />
                </asp:TemplateField>

                <asp:BoundField DataField="CaseID" HeaderText="Case ID" SortExpression="CaseID"  Visible="false"  />

            </Columns>
        </asp:GridView>


Code Behind:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ParameterPasser;
public partial class DisplayDerivativesDetail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
            //*  Grab the CaseID passed from DisplayDerivativesCases.aspx and convert to integer *// 
            //int intCaseID;
            //string strCaseID = Request.QueryString["CaseID"];
            //intCaseID = Convert.ToInt32(strCaseID);
            //// Get Case Info for display only
            //DerivativesBAL.DerivativesBAL obj10 = new DerivativesBAL.DerivativesBAL();
            //DataSet dsName = obj10.GetCase(intCaseID);
            m.Text = "StuffToShow";
            //lblCaseNumber.Text = dsName.Tables[0].Rows[0]["CaseNumber"].ToString();
            //lblNCPName.Text = dsName.Tables[0].Rows[0]["NCPNameLast"] + ", " +
            //dsName.Tables[0].Rows[0]["NCPNameFirst"] + " " +
            //dsName.Tables[0].Rows[0]["NCPNameMiddle"].ToString();
            //lblCourtNumber.Text = dsName.Tables[0].Rows[0]["CourtNumber"].ToString();
            //lblMonthlyAmt.Text = dsName.Tables[0].Rows[0]["MonthlyAmt"].ToString();
            //lblStartDate.Text = dsName.Tables[0].Rows[0]["StartDate"].ToString();
            //lblReviewDate.Text = dsName.Tables[0].Rows[0]["ReviewDate"].ToString();
            //lblEndDate.Text = dsName.Tables[0].Rows[0]["EndDate"].ToString();
            //if (lblCaseNumber.Text == null)
            //{
            //    lblCaseNumber.Text = "EMPTY";
            //}
            //else
            //{
            //    lblCaseNumber.Text = "HAS INFO";
            //}
    }
.

Recommended Answers

All 2 Replies

Have you set a breakpoint and debugged it?

Thanx Cherryhomesj,

I tried doing that but Debug did not seem to work. I did some research and found that there is an issue with Debug and IE8 where Debug stops debugging. After trying to get it to work, I gave up.

What I did do is opened up the designer in VS 2005. I have never used it and do all development in code. The designer showed that 'm' variable had no events attached. I selected Page_Load for the Load event and it worked. Not sure why since I have never had to do this before.

Anyway, the application now works. Thank you for your response to my question. I very much appreciate it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.