473,785 Members | 3,285 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting default value in detailsview template

I'm using a detailsview control that I want to use to insert data to a
table. One of the fields is a date field and I want that to default to
todays date. In classic asp I would do it like this:

<input name="textfield " type="text" value="<%=now() %>" />

How do I do this in ASP.NET, heere is my current code:

<asp:DetailsVie w ID="DetailsView 1" runat="server"
AllowPaging="Tr ue" AutoGenerateRow s="False" DataKeyNames="d ata_key"
DataSourceID="S qlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:TemplateFi eld HeaderText="dat a_key"
InsertVisible=" False" SortExpression= "data_key">
<InsertItemTemp late>
<asp:TextBox ID="TextBox1" runat="server"
Text='<%# Bind("data_date ") %>'></asp:TextBox>
</InsertItemTempl ate>
</asp:TemplateFie ld>
<asp:BoundFie ld DataField="data _comment"
HeaderText="dat a_comment" SortExpression= "data_comme nt" />
<asp:CommandFie ld ShowDeleteButto n="True"
ShowEditButton= "True" ShowInsertButto n="True" />
</Fields>
</asp:DetailsView >

Thanks

May 8 '07 #1
0 1861

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

Similar topics

1
3241
by: sck10 | last post by:
Hello, I have a GridView that list all the employees in our group. My select button (link) when clicked will open a DetailsView control of the employee selected. I have one BoundField in the form that I want to fill in programatically ("UpdatedBy"). So when the user selects the "edit" link, the field is pre-populated with this value. This value needs to submitted when the user clicks "update". Any help with this would be greatly...
2
3627
by: Andrew Robinson | last post by:
Is there any way to accomplish two way data binding in a Details View with a DataSet or DataTable as the DataSource. All I want is to get an updated DataSet or DataTable back from the DetailsView and then handle my updating manually. -Andrew
12
8706
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press update after making changes, but I don't want that update button. How can I get the updated object when the user presses one of my other action buttons?
1
4439
by: sck10 | last post by:
Hello, I am trying to change a value when a user goes into edit mode on a DetailsView control. I am trying to use the following, but can not figure out how to get to the bound field ("MyBoundField") to set its new value. Any help with this would be appreciated. Sub EmployeeDetailView_ModeChanged(ByVal sender As Object, ByVal e As EventArgs) Select Case CustomerDetailView.CurrentMode
2
2491
by: William LaMartin | last post by:
Is there a way to increase the width of the text boxes for the DetailsView in edit or insert mode? When I put the control in either edit or insert mode, the text boxes to type the new text are always much smaller than the available space in the row.
0
1248
by: Seok Bee | last post by:
Dear Experts, In my web application, I have a Master/Detail display of records using Gridview and DetailsView controls. Whenever, I made a selection of a record from the Gridview control, the detail information of the record will be displayed in the DetailsView control. Information in the editable in the detailsview by allowing user to have the edit option. On top of that I also allow user to add new record through the detailsview...
1
3485
by: Jim McGivney | last post by:
Using VWD I have an aspx page with a GridView and DetailsView controls, each using a different AccessDataSource. The DetailsView is displayed with appropriate data when the user selects one of the Grid's rows. In the DetailsView I would like the user to be able to select the sex (Female, Male, Unknown) by clicking a button on a RadioButtonList control. To do this I make a template row for the DetailsView, I place a RadioButtonList in the...
1
7733
by: Timothy H. Schilbach | last post by:
Hi Everyone, I am having a massive issue trying to get custom data into my DV. What I want to do is sooo simple: 1. I have a single DV on a page 2. I created my own template (see below) 3. I created the DetailsViewDataBinging sub which populates the field using a datatable 4. I created a ModeChanging Event handler to allow me to change the mode
0
1111
by: esi | last post by:
New to ASP.NET so any help you can offer would be great! I have been searching the web all day to try and figure out how I can add a default value to a field on a DetailsView control. I did find a few examples on the web and I understand what the code is trying to do, but I cannot get it to work for me. Here is my code: <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True"
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.