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 7718721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:14:08+00:00 2026-06-01T03:14:08+00:00

I have two dropdownlists, and two txtboxes which have a calendar popup extender, whenever

  • 0

I have two dropdownlists, and two txtboxes which have a calendar popup extender, whenever I choose an item different thant the first item , this code should populate texbox to current dates, My dropdownlists have an austoposbabk property selected, and are inside an update panel, when I choose and item it resets both textboxes instead to only the one that is on the SelectedIndexChanged

For example I need only to set the default date to the label that is inside the dropdownlist selectedIndexChanged

txtScanner_SelectedIndexChanged

will only set txtscanDate field to current date,,,
and is setting the date in the textbox on both .

Thanks for your help. Sorry my english is not very good.

<asp:DropDownList ID="txtPreppin" runat="server" CssClass="padding-input" 
 AutoPostBack="True" onselectedindexchanged="txtPreppin_SelectedIndexChanged">
  <asp:ListItem Text="-Select-" Value=''>-Select-</asp:ListItem>
  <asp:ListItem>Acevedo, Noe</asp:ListItem>
</asp:DropDownList>
<br />
<label for="recordtype">Date:</label>
<asp:TextBox ID="txtprepDate" runat="server" Enabled="False" ReadOnly="True"></asp:TextBox>
 <asp:CalendarExtender ID="txtprepDate_CalendarExtender" runat="server"
  Enabled="True" TargetControlID="txtprepDate" Format="MM/dd/yyyy">
</asp:CalendarExtender>                 

</td>
<td style="width: 306px">
<label for="recordtype">Scanner:</label>
<asp:DropDownList ID="txtScanner" runat="server" CssClass="padding-input" 
  AutoPostBack="True" onselectedindexchanged="txtScanner_SelectedIndexChanged">
 <asp:ListItem Text="-Select-" Value=''>-Select-</asp:ListItem>
 <asp:ListItem>Bueno, Nancy</asp:ListItem>
 </asp:DropDownList>

 <label for="recordtype">Date:</label>
 <br />
 <asp:TextBox ID="txtScanDate" runat="server" Enabled="False" ReadOnly="True"></asp:TextBox>
 <asp:CalendarExtender ID="txtScanDate_CalendarExtender" runat="server"
  Enabled="True" TargetControlID="txtScanDate" Format="MM/dd/yyyy">
 </asp:CalendarExtender>


protected void txtScanner_SelectedIndexChanged(object sender, EventArgs e)
{
 if (Page.IsPostBack)
 {
  if (txtScanner.SelectedItem.Text != null)
  {
    txtScanDate.Enabled = true;
    txtScanDate.ReadOnly = false;
    txtScanDate.Text = DateTime.Today.ToString("MM/dd/yyy");
  }
  else
  {
    txtScanDate.Enabled = false;
    txtScanDate.ReadOnly = true;
  }
 }
}

protected void txtPreppin_SelectedIndexChanged(object sender, EventArgs e) { if (Page.IsPostBack) { if (txtPreppin.SelectedItem.Text != null) { txtprepDate.Enabled = true; txtprepDate.ReadOnly = false; txtprepDate.Text = DateTime.Today.ToString("MM/dd/yyy"); } else { txtprepDate.Enabled = false; txtprepDate.ReadOnly = true; } } }

  • 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-06-01T03:14:09+00:00Added an answer on June 1, 2026 at 3:14 am

    I found my problem, I had the ViewState enabled = false on the master page, It was hard for me to find this, because my inherited page didnt show it disabled, but this was causing the problems with the textbox loosing the values on postback.Thanks

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

Sidebar

Related Questions

I'm building an asp.net cutom control inside which I have two dropdownlists: companyIdSelection and
I have one page with two dropdownlists with different IDs and in my codebehind
I have two dropdownlist which shows places in my asp.net MVC(C#) application. The First
I have two dropdownlists, the first is State & the second is City. I
I have two dropdownlists ,selecting the first dropdown causes postback and second dropdown gets
this problem is driving me really mad. In an Asp.Net-application, I have two DropDownLists,
I have two identical dropdownlists for identical subproperties of my item TaskViewModel. @Html.DropDownListFor(x =>
I have two DropDownLists on my form. There's no item in neither one. In
I have a webcontrol with two dropdownlists on in. When you choose something from
I have two DropDownLists one for the type of a soldier and one for

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.