C
cjbland
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.
<aspetailsView ....>
<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>
.........
</aspetailsView>
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.
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.
<aspetailsView ....>
<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>
.........
</aspetailsView>
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.