Update command
Har lavet en datalist med en databinding til et dataset (objectdatasource). Alt virker næsten, bortset fra update funktionen. Den siger at mine værdier er null.Her er et udklip af koden:
**********************************************************
public void DataList_UpdateCommand(Object Sender, DataListCommandEventArgs e)
{
ObjectDataSource1.Update();
DataList1.EditItemIndex = -1;
BindList();
}
<asp:DataList ID="DataList1" runat="server"
DataKeyField="id"
DataSourceID="ObjectDataSource1"
OnEditCommand="DataList_EditCommand"
OnUpdateCommand="DataList_UpdateCommand"
OnCancelCommand="DataList_CancelCommand">
<EditItemTemplate>
<asp:TextBox ID="header" runat="server" Text='<%# Eval("header") %>' Width="414px">
</EditItemTemplate>
</asp:DataList>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="DataSet1TableAdapters.newsTableAdapter" UpdateMethod="UpdateQuery">
<UpdateParameters>
<asp:Parameter Name="header" Type="String" />
<asp:Parameter Name="text" Type="String" />
<asp:Parameter Name="date" Type="DateTime" />
<asp:Parameter Name="enable" Type="Boolean" />
<asp:Parameter Name="Original_id" Type="Int32" />
</UpdateParameters>
</asp:ObjectDataSource>