Click to See Complete Forum and Search --> : Woe is me...


Mustang
09-20-2005, 10:59 AM
I have a textbox control in a webform that I am trying to get to prepopulate a date with.

In the Code behind I have a page load script to get the datetime:
Rec_Date.Text = System.DateTime.Now.ToSTring();
Month(Date) & "/" & Day(Date) & "/" & Year(Date) ;


The control looks like this:

<asp:TextBox ID="Rec_Date" runat="server" Text='<%# Bind("post_date") %>'></asp:TextBox>


The error I am getting is:
The name 'Rec_Date' does not exist in the current context

Can someone tell me what this means and perhaps how to fix it?

Thanks alot!

Mustang
09-26-2005, 09:43 AM
I was thinking that prehaps the reason that nobody has solved my question is because I needed to explain it better.

I am working with asp.net 2.0 using Microsoft's IDE Visual Studio 2005 in C#.

All I am trying to figure out is how to set a default value inside a databound textbox. Currently the textbox control already has a property for the text value as seen below:
<asp:TextBox ID="post_dateTextBox" runat="server" Text='<%# Bind("post_date") %>'></asp:TextBox>

So my question is, how can I set a default value for this control if the text field is already being used for a databound statement?

All I want to do is put a date in the textbox. I need to put it inside the textbox as opposed to inserting the date via a sql stmt because users need to be able to modify the date.

Thank you for your help.

Tim