Happy Independence Day! Hope you enjoyed spectacular fireworks. We do here around Boston too.
I am very sorry but I have just noticed that I missed the code of the DetailsView that I was talking about. Actually I copied a wrong piece of code.
I am trying to use DetailsView to insert data and use ListView to show the records with paging. Let me clarify the problems that I am confronting:
1. After insertion with the DetailView, the ListView does not refresh to show the inserted record even though the insertion causes postback.
2.After insertion, a TemplateField ("LogDate") of the DetailsView is not populated by code behind even though debugging confirms the code is executed.
<asp:DetailsView ID="DetailsView1" runat="server"
AutoGenerateRows="False" Caption="Stock Notes" CaptionAlign="Top"
CellPadding="4" DataKeyNames="Ticker,LogDate" DataSourceID="Finance"
DefaultMode="Insert" ForeColor="#333333" GridLines="None" Height="50px"
Width="451px">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<Fields>
<asp:BoundField DataField="Ticker" HeaderText="Ticker" ReadOnly="True"
SortExpression="Ticker" />
<asp:TemplateField HeaderText="LogDate" SortExpression="LogDate">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("LogDate") %>'></asp:Label>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="tbLogDate" runat="server" Text='<%# Bind("LogDate") %>'></asp:TextBox>
<cc1:CalendarExtender ID="tbLogDate_CalendarExtender" runat="server"
Enabled="True" TargetControlID="tbLogDate">
</cc1:CalendarExtender>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("LogDate") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Comments" HeaderText="Comments"
SortExpression="Comments">
</asp:BoundField>
<asp:BoundField DataField="Target" HeaderText="Target"
SortExpression="Target" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:DetailsView>