472,805 Members | 918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

How to get the today date on page load into the readonly text box

Hi
I have a readonly textbox i want to put the today date in there on th epage load but don't have any idea how to getthe dat inthere please help me
here is my code:

Expand|Select|Wrap|Line Numbers
  1. <%@ Page language="c#" Codebehind="Accomplishment.aspx.cs" AutoEventWireup="false" Inherits="Accomplishments.Accomplishment" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
  3. <HTML>
  4.     <HEAD>
  5.         <title>Accomplishment</title>
  6.         <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
  7.         <meta name="CODE_LANGUAGE" Content="C#">
  8.         <meta name="vs_defaultClientScript" content="JavaScript">
  9.         <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
  10.     </HEAD>
  11.     <body>
  12.         <form id="Form1" method="post" runat="server">
  13.             <table height="100%" cellSpacing="0" width="700" align="center" border="1">
  14.                 <tr>
  15.                     <td height="50"><IMG src="header.jpg" width="700"></td>
  16.                 </tr>
  17.                 <tr>
  18.                     <td vAlign="top">
  19.                         <table cellPadding="5" width="700">
  20.                             <tr>
  21.                                 <td>
  22.                                     FirstName:
  23.                                     <asp:TextBox ID="txtFirstName" Runat="server"></asp:TextBox>
  24.                                     LastName:
  25.                                     <asp:TextBox ID="txtLastName" Runat="server"></asp:TextBox></td>
  26.                             </tr>
  27.                             <tr>
  28.                                 <td>
  29.                                     DateCreated: 
  30.                                     <asp:TextBox ID="txtdatecreated" Runat="server" ReadOnly="True"></asp:TextBox>
  31.                                     ProejctName:
  32.                                     <asp:TextBox ID="txtProject" Runat="server"></asp:TextBox>
  33.                                     <asp:dropdownlist id="drpMonth" AutoPostBack="True" Runat="server">
  34.                                         <asp:ListItem Value="">Select a Month</asp:ListItem>
  35.                                         <asp:ListItem Value="01">January</asp:ListItem>
  36.                                         <asp:ListItem Value="02">February</asp:ListItem>
  37.                                         <asp:ListItem Value="03">March</asp:ListItem>
  38.                                         <asp:ListItem Value="04">April</asp:ListItem>
  39.                                         <asp:ListItem Value="05">May</asp:ListItem>
  40.                                         <asp:ListItem Value="06">June</asp:ListItem>
  41.                                         <asp:ListItem Value="07">July</asp:ListItem>
  42.                                         <asp:ListItem Value="08">August</asp:ListItem>
  43.                                         <asp:ListItem Value="09">September</asp:ListItem>
  44.                                         <asp:ListItem Value="10">October</asp:ListItem>
  45.                                         <asp:ListItem Value="11">November</asp:ListItem>
  46.                                         <asp:ListItem Value="12">December</asp:ListItem>
  47.                                     </asp:dropdownlist>
  48.                                 </td>
  49.                             </tr>
  50.                             <tr>
  51.                                 <td>
  52.                                     <asp:TextBox ID="txtdescription" Runat="server" Width="600" Height="150" TextMode="MultiLine"></asp:TextBox>
  53.                                 </td>
  54.                             </tr>
  55.                             <tr>
  56.                                 <td>
  57.                                     <asp:Button ID="cmdSubmit" Text="Submit" Runat="server"></asp:Button>
  58.                                 </td>
  59.                             </tr>
  60.                         </table>
  61.                     </td>
  62.                 </tr>
  63.             </table>
  64.         </form>
  65.     </body>
  66. </HTML>
  67.  
  68.  
if any one know about this please help me
Oct 2 '07 #1
2 2015
nateraaaa
663 Expert 512MB
In the page_load event of your code behind you need the following code

Expand|Select|Wrap|Line Numbers
  1. txtdatecreated.Text = DateTime.Now.ToShortDateString();
Nathan
Oct 2 '07 #2
Thanks very much it helped for for me alot thanks verymuch once again
take care
Oct 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
2
by: Philip Rayne | last post by:
I have 2 datagrids, both with databound columns that I have dynamically added. I have an EditCommandColumn on both grids. EnableViewState is enabled on both of the grids. When I click the edit...
0
by: Jeff | last post by:
Hi - I have an ASP.NET page that hangs (some times; if it loads for you, try refresh/F5 several times) when I try to run it on my localhost. It contains an HTML table for formatting, and within...
4
by: Kun | last post by:
i have a form which takes in inputs for a mysql query. one of the inputs is 'date'. normally, a user has to manually enter a date, but i am wondering if there is a way to create a button which...
4
by: Tamichan | last post by:
If anyone can point me in the right direction it would be most appreciated. I find that if I change the page size, either maximize or restore down, my web app freezes. I've put breakpoints in...
12
by: Rob Meade | last post by:
Hi all, Ok - I've come from a 1.1 background - and previously I've never had any problem with doing this: Response.Write (Session("MyDate").ToString("dd/MM/yyyy")) So, I might get this for...
0
by: ammweb | last post by:
I am new to VB.NET and I am wanting the date December 12, 2006 to show up when the page is loaded. I have this on a label at the top of a page. Protected Sub Page_Load(ByVal sender As Object,...
1
by: RSH | last post by:
Hi, I have a situation where I have a user Control (ResultHeader.ascx) that has a button. I am placing that control into a page (samplePage.aspx). I have setup a custom event, that should from...
6
by: dean.h.brown | last post by:
How do you get the Calendar date when the page first loads? I have this code (which works once the user selects a date) - I get "12:00:00 AM" for the label.text when the page first loads: ...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.