A New Internet Library: Add Your Website/Blog or Suggest A Website/Blog to our Free Web Directory http://anil.myfunda.net.

Its very simple, free and SEO Friendly.
Submit Now....

Tuesday, July 22, 2008

Add DateTime.Today to textbox.text in formview

Hi, I am building a form using the formview InsertItemTemplate and I would like to have a read only textbox that displays the current date so that when the user submits the data in a form the DateSubmitted field will auto insert into the DB DateTime.Today.  I was trying to assign the textbox.text date value in page_load() event as

DateTime dtSubmitted = DateTime.Today;

txtDateSubmitted.text = Convert.ToString(dtSubmitted);

However, when I try to do that, my code behind isn't recognizing the textbox, in fact none of the controls in my Formview are appearing in the intellisense dropdown list as I type in the name of a control in the Fomview Control.  The exact error message I am receiving is:  Error 1 The name 'txtDateSubmitted' does not exist in the current context 

Does anyone know why I can't access the controls in my formview?  Thanks in advance.



Read Full article Here.

No comments:

Post a Comment

Post your comments here:

Originals Enjoy