Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Need To Click Edit Button Twice On Datagrid

Reply
Thread Tools

Need To Click Edit Button Twice On Datagrid

 
 
=?Utf-8?B?SmViQnVzaGVsbA==?=
Guest
Posts: n/a
 
      10-14-2005
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


 
Reply With Quote
 
 
 
 
J. Jespersen
Guest
Posts: n/a
 
      10-14-2005

> 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



 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmViQnVzaGVsbA==?=
Guest
Posts: n/a
 
      10-14-2005
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);
}

 
Reply With Quote
 
=?Utf-8?B?SmViQnVzaGVsbA==?=
Guest
Posts: n/a
 
      10-15-2005
FYI: AutoEventWireup="false"

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
have to click 'edit' button twice for event handler to fire. dilbert ASP .Net 0 01-28-2008 05:26 PM
have to click 'edit' button twice for event handler to fire. dilbert ASP .Net 0 01-28-2008 05:25 PM
GridView control enters edit mode when I click Edit link twice Jaime Stuardo ASP .Net Web Controls 0 04-07-2006 12:47 AM
Would like to load a datagrid already in edit mode instead of having the user click the edit button Frank Kurka ASP .Net Datagrid Control 8 04-29-2005 09:33 AM
button click event being called twice on click mike parr ASP .Net 1 05-20-2004 04:02 PM



Advertisments