473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Need To Click Edit Button Twice On Datagrid

I'm a novice building a datagrid crud page and I have ASP.NET Cookbook and 4
web references to assist me. I am using VS 2003 so the code is not "inline".

My problem is that when I click the Edit button on the grid nothing happens.
Then I click it again and the expected happens i.e. the affected row is
re-presented in text boxes.

Both clicks of the Edit button cause a Page_Load but only the first fires
the Edit event (where grid.EditItemIndex is set).

Any help greatly appreciated.
jebbushell*yahoo*com
Nov 19 '05 #1
3 2493
My problem is that when I click the Edit button on the grid nothing
happens.
Then I click it again and the expected happens i.e. the affected row is
re-presented in text boxes.


Sounds like you're doing a .databind in your page_load without checking to
see if "page.isPostback". Try something like....

(in page_load)
if not page.isPostback then
myDatagrid.databind
end if

(in edit command)
myDatagrid.databind

Should get you on the right track.

Jeppe Jespersen
Denmark

Nov 19 '05 #2
I don't think it's that. FYI the "database" I'm using is a directory
containing .txt files configured as a server via Jet. Of couse, that should
be irrelevant, but it has to be unusual so i thought I'd better tell. Here's
the Page_Load:

private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
oleDbDataAdapter1.Fill(dsPumps1);
dgPumps.DataBind();
}
dgPumps.EditCommand +=
new DataGridCommandEventHandler(this.dgPumps_Edit);
dgPumps.CancelCommand +=
new DataGridCommandEventHandler(this.dgPumps_Cancel);

dgPumps.ItemCommand +=
new DataGridCommandEventHandler(this.dgPumps_Command);
}

Nov 19 '05 #3
FYI: AutoEventWireup="false"

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: headbig003 | last post by:
Hello I am using dataset to populate datagrid. I use button outside of datagrid to insert new row and update datagrid. After updated or inserted new information to datagrid, user has to...
0
by: Alex | last post by:
Interested in more .NET stuff visit www.dedicatedsolutions.co.uk The DataList is not as powerful as the DataGrid. It requires more work from you since it has no default data presentation format....
2
by: Mike | last post by:
I want to double click on a row within the grid and have it take me to a edit screen for that row. Currently I allow the user highlight a row and click the Edit Button and that takes them to a...
1
by: Mark | last post by:
Hello, I have a need to add a button column to a datagtrid, below is my code and although it does not produce an error, it also does not work, any help? I'm hoping that I can capture the button...
6
by: Tim Meagher | last post by:
Can anyone help me figure out how to apply a stylesheet to a pushbutton defined in the asp:BoundColumn or asp:EditCommandColumn elements of a datagrid?
3
by: Wang | last post by:
Here is the code for a webcontrol, quite simple: ------------------------------------------------------------------------------------------------------------- <%@ Control Language="c#"...
0
by: Diffident | last post by:
Hello All, I have an asp:button and I have tied an eventhandler to this button's click event which means that the eventhandler should be executed everytime I click the button. But to my...
7
by: Diane | last post by:
Hi- I've been struggling with this problem and none of the fixes posted seem to help out at all. Yet, it seems like such a simple problem... I have a DataGrid, and load it up with data on...
0
by: =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post by:
I'm having trouble working with a Summary Validation control. I need to click my submit button twice for the Summary to display when validation errors occur on the page. Background: My page...
0
BarryA
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...
1
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.