How to set a default value in a text box

I have a gridview that looks to a textbox for the parameter to pass to my stored procedure in SQL.  I would like to have the textbox default when the page loads to yesterdays date so the gridview will run with yesterdays date as the parameter, but I also need to be able to re-run the stored procedure when the user changes the date in the textbox.  I don't know how to set the textbox to default to yesterdays date except for using the pageload event which obviously means I can only use yesterdays date because whatever date is typed in is just reset when the page reloads.  Can someone please help me with this?  I know very little about asp.net and visual studios.  
gofferAsked:
Who is Participating?
 
CB_ThirumalaiConnect With a Mentor Commented:
ok, here is an example
<!-- in the aspx page -->
<asp:TextBox ID="textbox1" runat="server" EnableViewState="true" />
// in the page load
If Not IsPostBack Then
   textbox1.Text = CStr(Format(Date.Now.AddDays(-1), "MM/dd/yyyy"))
End If
// If the user changes the date, it will hold the new date

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.