473,795 Members | 3,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:DetailsVie w ....>
<asp:TemplateFi eld HeaderText="Dat e Entered"
SortExpression= "d_entered" >
<InsertItemTemp late>
<asp:TextBox ID="DateEntered " name="DateEnter ed" Text='<%# DateTime.Now
%>' ReadOnly="false " runat="server" />
</InsertItemTempl ate
</asp:TemplateFie ld>
.........
</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$c tl0x"
where x is a number. The ID for my date field is
"DetailsView1$D ateEntered".

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

protected void DetailsView1_It emInserting(Obj ect sender,
DetailsViewInse rtEventArgs e)
{
a.Text = e.Values["serial_no"].ToString();
b.Text = e.Values["barcode"].ToString();
c.Text = e.Values["DateEntere d"].ToString();
}

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

Feb 24 '06 #1
0 1104

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

Similar topics

1
1925
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 values from the individual fields in those user controls. So far I am not able to access the controls at postback. Any suggestions would be appreciated. Joel Reinford
1
2017
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. Any suggestions please?
0
1175
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 in a routine called LoadPostData that has the following signature and which implements the IPostBackDataHandler event handler public bool LoadPostData(string postDataKey,
0
1189
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 in a routine called LoadPostData that has the following signature and which implements the IPostBackDataHandler event handler public bool LoadPostData(string postDataKey,
2
1164
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 cells of the grid, and write them to the database. Will I be able to loop through the items in the grid, and retrieve the values?
3
2544
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 controls are not present nor their valves in Request.Form.AllKeys.
0
2073
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 from database to a VB.net app, they retrieve the database fields as a record set eg. "select name, suburb from myTable"
0
1888
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 GridView, accepts information via dropdowns embedded in the first row of the GridView about which incoming fields should go to which database fields, and writes the data to the database. The incoming data has an arbitrary number of columns so I create...
5
4454
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 survive postback. This seems to be true. However, this seems to make dynamically adding controls rather pointless to me, since if you cannot retrieve the values of the controls when you perform a postback, why add the controls in the firstplace?...
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
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
10164
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
9042
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...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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.