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.
Hope someone can assit. 3 1065
What's in your Page_Load event? Are you remembering not to only fill the
grid there when it's NOT a postback?
Ken
"Cralis" <in**@listerhome.comwrote in message
news:bd**********************************@a3g2000p rm.googlegroups.com...
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.
Hope someone can assit.
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, nothing about the grid...
You're maybe onto something though... But I don't do anything to
populate the grid. I just setup the ODS....
Is there a way to stop it from what it's doing?
No ideas? :(
I think I need to use the Row_Updating event.. but it seems strange... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: P |
last post by:
Hello,
I am having a difficult time updating a record via a stored procedure using
the gridview and sqldatasource. I cannot seem to be able to find a way to set
everything up so that I can pass...
|
by: |
last post by:
Hello,
I have created an ASP.NET 2.0 application that utilized a Gridview Control
to display and update/delete data.
The problem I am having is that the gridview control is displaying the data...
|
by: Mike Kelly |
last post by:
I've chosen to implement the "optimistic concurrency" model in my
application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to
my main tables. I read the value of the column in my...
|
by: Brian McClellan |
last post by:
Just wondering if anyone has a simple example of creating a gridview
completely programmatically, i'm not doing anything terribly sophisticated.
When creating the gridview declaratively evertying...
|
by: Michael Kellogg |
last post by:
I have a problem wherein a query that updates a GridView doesn't seem to
really stay in sync with a label I have above the GridView.
I have a GridView object that I'm updating with information...
|
by: =?Utf-8?B?Q2hyaXM=?= |
last post by:
Hi,
I have a gridview which I added a
<asp:CommandField EditText="E" CancelText="C" UpdateText="U"
ButtonType="Link" ShowEditButton="True" />
my gridview looks like this
<asp:GridView...
|
by: SAL |
last post by:
Hello,
I have a Gridview control (.net 2.0) that I'm having trouble getting the
Update button to fire any kind of event or preforming the update. The
datatable is based on a join so I don't know...
|
by: steve |
last post by:
I have been fighting with trying to update a GridView for a while. I
don't want to use the "built-in" way to do it because I am using
business layer methods for updating and deleteing and I don't...
|
by: BizWeb |
last post by:
Hi, i am new to ASP.NET. I have write a very simple code to try the
updating of the GridView but it is not updating the data. Below is the
simple code that i have use.
<%@ Page Language="vb"...
|
by: xMetalDetectorx |
last post by:
Hi Everyone,
I have a very simple web app that uses .Net 2.0 login control to authenticate users and allow access to an "admin" folder. Inside that admin folder I have one page that has a...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |