grid postback

C

Cam

in a grid with templates update,delete, edit. why the buttons need to be
clicked twice in order to take action.

grid.item command fires up every time a button is clicked.
it's just the button action that don't execute....

anyone else had that issue?
 
P

Phillip Williams

The answer depends on which asp.net version are you using and how do you
databind the grid?
 
C

Cam

v 1.1
void refreshgrid(){
grid.datasource = ds (populated dataset)
grid.databind.
}
grid_itemcommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e){
switch(e.commandname){
case "update":
//stepped through here.. update the dbase
refreshgrid(); //though executed... doesn't refresh.
break;
}
}
if i close the browser and open the page again... the change made is
displayed.
click on edit once... nothing. twice then edit box is there.
click on save onece... nothing. twice it saves and don't display...
never seen this b 4
 
P

Phillip Williams

Is the grid placed on the webform dynamically or declaratively? When the
page is loaded how do you call the refreshgrid method and during which event
handling?
 
P

Phillip Williams

Check the AutoEventWireup value in the page directive and the OnInit method
within the "Web Form Designer generated Code" region. If the AutoEventWireUp
were set to "true" and the OnInit has this line of code in it:

this.Load += new System.EventHandler(this.Page_Load);

If that is the case then your application is calling the Page_Load twice
thereby messing up the databinding sequence that you have. If it turns out to
be the case you can either set the AutoEventWireUp=â€false†or remove wiring
up the event handling in the OnInit method.
 
C

Cam

Hi!
AutoEventWireup was and is =false.
Oninit has
this.Load += new System.EventHandler(this.Page_Load);

setting AutoEventWireup to true did not help the issue.
i tried on postback contrary to !postback... still nothing
-------------------------------------------------
all other controls on the page outside the grid work fine
it's the controls inside the grid that require a double click.
the causevalidation property is set to true
a couple of folks had the same issue in the forum but no solution was
provided...

Thanks
 
C

Cam

found the solution..... delete the page and rebuilt it. it works fine same
codes.....

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top