Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6075493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:30:03+00:00 2026-05-23T10:30:03+00:00

I have a .aspx file that is running some simple code. When I submit

  • 0

I have a .aspx file that is running some simple code. When I “submit” my form, I am displaying some information in a label(lblCount) that is dependent on the code in my dropdownlist. When I submit more than once, it re-creates the label – I can’t see why, unless I’m missing some sort of property. Is there a property that keeps the label from redrawing?

<html>
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
    <div>
        <asp:Label runat="server" id="lblError" />
        <asp:DropDownList id="monthList" AutoPostBack = "True" runat = "server">            
            <asp:ListItem Selected = "True" Value = "January"> January </asp:ListItem>
            <asp:ListItem Value = "February"> February </asp:ListItem>
            <asp:ListItem Value = "March"> March </asp:ListItem>
            <asp:ListItem Value = "April"> April </asp:ListItem>
            <asp:ListItem Value = "May"> May </asp:ListItem>
            <asp:ListItem Value = "June"> June </asp:ListItem>
            <asp:ListItem Value = "July"> July </asp:ListItem>
            <asp:ListItem Value = "August"> August </asp:ListItem>
            <asp:ListItem Value = "September"> September </asp:ListItem>
            <asp:ListItem Value = "October"> October </asp:ListItem>
            <asp:ListItem Value = "November"> November </asp:ListItem>
            <asp:ListItem Value = "December"> December </asp:ListItem>
        </asp:DropDownList>
        <asp:Label runat="server" id="lblCount" />
    </div>
    <asp:Button ID="submitButton" OnClick="MonthSelection" Text="Submit" runat="server" />
    <div>
    </div>
</form>
</body>
</html>

MONTH SELECTION:

protected void MonthSelection(object sender, EventArgs e)
{
    dateLookup = monthList.SelectedItem.Value;
    selectedMonth.Text = dateLookup.ToString();

    switch (dateLookup)
    {
        case "January":
            monthDate = 01;
            break;
        case "February":
            monthDate = 02;
            break;
        case "March":
            monthDate = 03;
            break;
        case "April":
            monthDate = 04;
            break;
        case "May":
            monthDate = 05;
            break;
        case "June":
            monthDate = 06;
            break;
        case "July":
            monthDate = 07;
            break;
        case "August":
            monthDate = 08;
            break;
        case "September":
            monthDate = 09;
            break;
        case "October":
            monthDate = 10;
            break;
        case "November":
            monthDate = 11;
            break;
        case "December":
            monthDate = 12;
            break;
    }

    try
    {
        string sql = "SELECT COUNT(*) FROM members_ WHERE DATEPART(month, DateUnsub_) = " + monthDate + " AND DATEPART(year, DateUnsub_) = 2011 AND DATEDIFF(day, DateJoined_, DateUnsub_) <= 30";
        String[][] results = lm.SqlSelect(sql);

        if (results != null)
        {
            for (int i = 0; i < results.Length; i++)
            {                
                if (results[i] != null)
                {
                    for (int j = 0; j < results[i].Length; j++)
                    {                        
                        if (results[i][j] != null)
                        {
                            if (results[i][j].Length > 5)
                                lblCount.Text += results[i][j];
                            else
                                lblCount.Text += results[i][j];
                        }
                    }
                } 
            }
        }
    }
    catch (SoapHeaderException ex)
    {
        lblError.Text = ex.Message;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:30:04+00:00Added an answer on May 23, 2026 at 10:30 am

    I figured out what was wrong – it was somebody else’s code that I hadn’t really looked at. They were adding to the value (using +=). I just took away the plus, and it worked. sigh All that over something so small.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some inline code in an aspx file that executes: <dd><%= encode(Listing.Address.Line1) %>
In my .aspx.cs I have a code that reads a .xml file and I
I have an .aspx file that outputs an image using the following methods: Server.MapPath(somefile.png)
In the filesystem I have /file.aspx /directory/default.aspx I want to configure IIS so that
I have a page base class that has no .aspx file and so I
I have an updateprogress in my aspx file, which has a label control in
I have a function in a .js file that takes information stored in localStorage
(Warning - asp newbie) I have an aspx file with the tag <%@ Page
I have been told to edit this file in Sharepoint Designer: /_layouts/KWizCom_WikiPlus/CreateNew.aspx I found
I have this on my web.config file: <authentication mode=Forms> <forms loginUrl=login.aspx defaultUrl=Venues.aspx /> </authentication>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.