473,378 Members | 1,346 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,378 software developers and data experts.

Display Todays Date in DetailView Template Field while Inserting ?

Hi,

Any Idea how to Display Todays Date in DetailView Template Field while Inserting ?

For example: When I click on New Button of DetailView Control, I need to display Today's Date in a Template Field text box.

I tried following in DetailView1_ModeChanged Event but could not succeed.

Protected Sub DetailsView1_ModeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.ModeChanged

Dim oText As TextBox = CType(Me.DetailsView1.Rows(0).FindControl("txtmyDa te"), TextBox)

oText.Text = Date.Today.ToShortDateString
EndSub

Best Regards,

Luqman


Apr 6 '07 #1
2 3749
On Apr 6, 3:57 pm, "Luqman" <pearls...@cyber.net.pkwrote:
Hi,

Any Idea how to Display Todays Date in DetailView Template Field while Inserting ?

For example: When I click on New Button of DetailView Control, I need to display Today's Date in a Template Field text box.

I tried following in DetailView1_ModeChanged Event but could not succeed.

Protected Sub DetailsView1_ModeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.ModeChanged

Dim oText As TextBox = CType(Me.DetailsView1.Rows(0).FindControl("txtmyDa te"), TextBox)

oText.Text = Date.Today.ToShortDateString

EndSub

Best Regards,

Luqman
Try this

in the txtMyDate.OnDataBound event set the Text property to the date

Apr 7 '07 #2
Hi,

I tried following and it worked out, thanks a lot.

Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DetailsView1.DataBound

If DetailsView1.CurrentMode = DetailsViewMode.Insert Then

Dim oText As TextBox = CType(Me.DetailsView1.FindControl("txtmyDate"),
TextBox)

oText.Text = Date.Today.ToShortDateString

End If

End Sub

Best Regards,

Luqman



"wmain" <ma*********@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
On Apr 6, 3:57 pm, "Luqman" <pearls...@cyber.net.pkwrote:
>Hi,

Any Idea how to Display Todays Date in DetailView Template Field while
Inserting ?

For example: When I click on New Button of DetailView Control, I need to
display Today's Date in a Template Field text box.

I tried following in DetailView1_ModeChanged Event but could not succeed.

Protected Sub DetailsView1_ModeChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DetailsView1.ModeChanged

Dim oText As TextBox =
CType(Me.DetailsView1.Rows(0).FindControl("txtmyD ate"), TextBox)

oText.Text = Date.Today.ToShortDateString

EndSub

Best Regards,

Luqman

Try this

in the txtMyDate.OnDataBound event set the Text property to the date

Apr 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Gerry Viator | last post by:
Hi all, I have a textbox were a time is typed in like: upto 4 numbers 1900 300 1000 1425 I would like as they type the text to show todays date plus the time they
1
by: garyusenet | last post by:
Using VB Express and SQL. I have an sql database. what function gives me todays date and time? and do i enter it in the 'default' property for the column in the database? i've tried now()...
2
by: Chuck | last post by:
Using a macro to output a query to an Excel file. Is there a way to automatically add todays date in the file spec? As: C:\Access Data\ & todays date.xls Chuck ....
0
by: Mike | last post by:
I have a detailview, with several template columns in it. It's setup so that a user views info from a datagrid, and if they want to add another row, they click a button. The button causes a...
6
by: supasnail | last post by:
I've been going round in circles here trying to get this to work and my ignorance of ASP is now showing me up. I want to construct a query string to allow me to filter entries to be displayed on...
1
by: Mark12345 | last post by:
Hi all before I begin to tell you my problems just a big thanks to Mary McCarthy who helped me lots. Thank You Mary!!! Right todays problems are Getting the date in my form automatically. (read...
0
by: =?Utf-8?B?THVib21pcg==?= | last post by:
Hi, I have a GridView and Dataview controls. If user clicks on a row in GridView, the details will be shown in DetailView. 1/ I want to show in DetalView only details field - without column...
8
by: Trev | last post by:
Hi Can anyone point me in the right direction here, I would like to open a table in access 2003 by date. I have an asp web page which needs to read data from a table with each days today's date...
3
by: jonosborne | last post by:
Hi guys, im a bit of a novice being thrown in at the deep end ! Using MS Access 97 i have a table with data that is updated once a day from an Excel spreadsheet. I need a way of identifying when data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.