0
在我的RowDataBound事件中,我想更新行值,但是我無法將我的對象轉換爲DataRowView。是否有另一種方式來更新行列?如何在沒有datarowview的情況下更新gridview行?
這是我的。它不能將類型提供轉換爲DataRowView。
/// <summary>
/// Gridview Row Data Bound
/// </summary>
protected void grdvOffers_RowDataBound(object sender, GridViewRowEventArgs e)
{
// Converts the UTC date to PST timezone
if (e.Row.RowType == DataControlRowType.DataRow)
{
//DataRow row = ((DataRowView)e.Row.DataItem).Row;
Offer row = ((Offer)e.Row.DataItem).Row;
DateTime utcTime = row.Field<DateTime>("Created");
DateTime dtUpdateDateTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, CFrmFunctions.GetPresetTimeZone());
row.SetField<DateTime>("Created", dtUpdateDateTime);
}
}
<asp:ObjectDataSource ID="objOfferDataSource" runat="server" SelectMethod="GetAllOffers"
TypeName="CancelForms.Repositories.OfferRepo"></asp:ObjectDataSource>
您能否顯示綁定代碼? (IE grdvOffers.DataSource = ????) – Steve