Hi guys,
I am new to GridViews.. I have a gridview that displays 3 columns.
Description, MahUsed and a calculated % Used field.
When I click Edit on the row, the MahUsed goes into Edit mode, and I
can change the value.
Now the problems start.
I click 'Update', and I end up with the original value.
The ObjectDataSource has an Update method, that points to this
function:
public void UpdatePackUsage(int Id, int Mahusage)
{
dbfb.UpdatePackUsage(Id, Mahusage);
}
If I put a breakpoint on this function, it is getting hit, however,
the value for Mahusage is always the ORIGINAL value. That is, it
never
changes to what I have typed in the edit box.
Do I need to use the RowUpdating event? I'm not at the moment, but am
wondering if I need to do something like:
protected void GridView1_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
FlightBatteryService fbs = new FlightBatteryService();
fbs.UpdatePackUsage(int.Parse(e.Keys["Id"].ToString()),
int.Parse(e.NewValues["Mahusage"].ToString()));
DataBind();
}
I tried that, and removed the UpdateMethod from the ODS, but then I
get an error about requiring an update method if editing is to be
used.
I'm doing this on PageLoad:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FlightLogService fls = new FlightLogService();
oFlightLog flight =
fls.Get(int.Parse(Session["selectedflightid"].ToString()));
lblAircraft.Text = flight.Aircraft;
lblConfiguration.Text = flight.Configuration;
lblCurveType.Text = flight.Curve;
lblDate.Text = flight.Flightdate.ToString("dd MMMM
yyyy");
lblStyle.Text = flight.Flyingstyle;
tbMin.Text = flight.Minutes;
tbSeconds.Text = flight.Seconds;
}
}
So, the GridView and ODS aren't being refered to in code. It's all
setup at design time... Postback issue?
Hope someone can assit.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---