473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 2040
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.