473,396 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Retrieving fields with default values in ASP.NET 2.0 in Postback

First off I apologize if this has been discussed before, I'm not
certain how to search for what I'm looking for so I figured I'd throw
this out there and see what I got.

I am working with a DetailsView (Insert mode) in ASP.NET 2.0 and one of
the fields I give a default value.

<asp:DetailsView ....>
<asp:TemplateField HeaderText="Date Entered"
SortExpression="d_entered">
<InsertItemTemplate>
<asp:TextBox ID="DateEntered" name="DateEntered" Text='<%# DateTime.Now
%>' ReadOnly="false" runat="server" />
</InsertItemTemplate
</asp:TemplateField>
.........
</asp:DetailsView>

When I click the insert button all of the values of my form are
returned except for the date entered. I viewed the source of my main
page and all of my other inputs have an id of "DetailsView1$ctl0x"
where x is a number. The ID for my date field is
"DetailsView1$DateEntered".

In my debugging I've created a few labels and I am setting them via:

protected void DetailsView1_ItemInserting(Object sender,
DetailsViewInsertEventArgs e)
{
a.Text = e.Values["serial_no"].ToString();
b.Text = e.Values["barcode"].ToString();
c.Text = e.Values["DateEntered"].ToString();
}

The page errors on the "c.Text = ..." line and it says that
"DateEntered" doesn't exist. I am obviously missing something here,
does any one have any input? Thanks in advance.

Feb 24 '06 #1
0 1086

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

Similar topics

1
by: Joel Reinford | last post by:
I am working on an ASP.NET web app. One of the pages will be using several user controls. The controls will be loaded dynamically based on SQL Server data. I need to be able to retrieve the...
1
by: Victor | last post by:
I'm retrieving values from the textboxes that I created dynamically. However I get commas appended to my text values and just a comma wherever the textbox is empty. Dont know what is causing this....
0
by: Mark | last post by:
Hi, I am playing around with creating custom server controls for use within a ASP.NET page. I am creating a contact form and have the following question I am capturing the form postback data...
0
by: Mark | last post by:
Hi, I am playing around with creating custom server controls for use within a ASP.NET page. I am creating a contact form and have the following question I am capturing the form postback data...
2
by: mschelstrate | last post by:
I am attempting to allow a user to update multiple rows and columns in a datagrid, when the user clicks a "Save" button, the postback occurs, at which time I need to retrieve all valuse form the...
3
by: Dotnet Gruven | last post by:
I've built a WebForm with a Table added dynamically in Page_Load when IsPostBack is false. The table includes a couple of TextBoxes, RadioButtonLists and CheckboxLists. On postback, those...
0
by: Andy | last post by:
Hi All. I'm working for a company that has set out a guideline for retrieving data from a database. Nobody can explain to me the reason for the following. When retrieving a set of records...
0
by: yeltsin27 | last post by:
I need some advice on handling dynamically added controls in a GridView. My app takes an uploaded CSV file containing addresses, converts it to a DataTable, databinds the DataTable to a...
5
by: Nathan Sokalski | last post by:
I have a custom control that I wrote (I inherit from System.Web.UI.WebControls.CompositeControl). I dynamically add this control to my Page, but I was told that dynamically added controls do not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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...

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.