Hi Vbnetdev,
Welcome to the ASPNET newsgroup.
As for the two detailsview questions you mentioned, I think both of them
require additioal customization on the columns/fields. For such scenario,
it's better to use TemplateFields instead of the default BoundField. In vs
2005's design-view, the DetailsView's smartTag wizard provide the UI to let
us convert a certain boundfield to a templatefield. After that, we can do
some customization on the template of the certain column/field. e.g: we can
add some addtional controls into the template (like calendar...).
For your two questions, the first one (set the max rowID to the textbox in
insert template) can be done by registering the DetailsView' ItemCreated
event, and add some code to manually query the max rowID allowed from the
database and assign the value to the insert template's certain textbox. e.g:
protected void DetailsView1_ItemCreated(object sender, EventArgs e)
{
if (DetailsView1.CurrentMode == DetailsViewMode.Insert)
{
//find the certain control and assign the value queried from db
to it
}
}
For the second question, we can put a calendar in the InsertTemplate, and
use its SelectedDatechanged event to update the selected date to the
certain textbox in the InsertItemtemplate. e.g;
==========detailsview's template field========
<asp:TemplateField HeaderText="Description" SortExpression="Description">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("Description") %>'></asp:TextBox><br />
<asp:Calendar ID="cld1" runat="server"
OnSelectionChanged="cld1_SelectionChanged"></asp:Calendar>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("Description") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("Description") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True"
ShowInsertButton="True" />
</Fields>
</asp
etailsView>
===================
=======calendar's event handler===========
protected void cld1_SelectionChanged(object sender, EventArgs e)
{
Calendar cld1 = sender as Calendar;
TextBox txt = cld1.NamingContainer.FindControl("TextBox1") as
TextBox;
txt.Text = cld1.SelectedDate.ToString("yyyy-MM-dd");
}
==========================
Hope this helps.
regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)