0
我在事件中遇到問題OnItemUpdate ..在字典中NewValues是舊值。哪裏不對?如何獲得新的價值?ASP.NET FormView OnItemUpdate - 未更新新值
<asp:FormView
runat="server"
ID="frvKartaCharakterystyk"
RenderOuterTable="false"
DefaultMode="Edit"
OnItemUpdating="frvKartaCharakterystyk_ItemUpdating">
<EditItemTemplate>
<div class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label" for="inputProdukt">Produkt</label>
<div class="col-sm-9">
<asp:TextBox runat="server" id="inputProdukt" CssClass="form-control" Text='<%# Bind("Produkt") %>' />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-6 col-sm-3"><asp:LinkButton runat="server" CommandName="Update" type="button" class="btn btn-primary btn-lg btn-block">Zapisz</asp:LinkButton></div>
<div class="col-sm-3"><asp:LinkButton runat="server" CommandName="Cancel" OnClick="Cancel_Click" type="button" class="btn btn-default btn-lg btn-block">Anuluj</asp:LinkButton></div>
</div>
</div>
</EditItemTemplate>
</asp:FormView>
我隱藏:
protected void frvKartaCharakterystyk_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
try
{
this.KartaCharakterystyk.Produkt = (string)e.NewValues["Produkt"];
Response.Redirect("KartyCharakterystyk.aspx#record-" + (KartaCharakterystyk.Id - 1));
}
catch (Exception ex)
{
}
}
沒有錯誤消息。事件正確啓動。 e.NewValues詞典存儲舊值。 – BLuM