Hi Jeff,
You could use a little client-side JavaScript attached to the server-side
button (show below). By including 'return false', you avoid the postback. For
variations on the formatting of the date, look here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/jscript7/html/jsobjdate.asp
or in any good JavaScript site.
Does this help?
Ken
MVP [ASP.NET]
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add _
("onclick", "var theDate=new Date();" & _
"document.forms[0].txtDate.value=theDate;return false;")
End Sub
<form id="Form1" method="post" runat="server">
<asp:textbox id="txtDate" runat="server"></asp:textbox>
<asp:button id="Button1" runat="server" text="Default"></asp:button>
</form>
--
Microsoft MVPs have a question for *you*: Are you patched against the Worm?
http://www.microsoft.com/security/security_bulletins/ms03-026.asp
I'd like to have a text box on my webform and a button beside that will set
the current date in the text box when the button is clicked. Is there a way
to do this without doing a postback?
Thanks for your help.
Jeff