Data grid doesn't fire events

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey
I tried to make ASP.Net site with a datagrid. On the dg there is a button
columnt with command set to select. I put in the code some very simple
ItemCommandEvent. In the ... generated code there is this.dgMydata += ... so
it should be ok. But it's not. I tried to remove it and recreate everything
still nothing. In code there is of course the procedure that should be run.
What went wrong ?
Jarod
 
Set the EnableViewState property of the DataGrid to "True" and the
AutoEventWireup property for the page to "false" . The DataGrid needs its
view state for firing events and the AutoEventWireup will make a second call
to all of your events is set to True. You don't need this because you are
already wiring them with the "this.dgMydata += ..." instruction.

S. L.
 
Set the EnableViewState property of the DataGrid to "True" and the
AutoEventWireup property for the page to "false" . The DataGrid needs its
view state for firing events and the AutoEventWireup will make a second call
to all of your events is set to True. You don't need this because you are
already wiring them with the "this.dgMydata += ..." instruction.
I already had the autoEventWireup set to false and EnableViewState to true,
but after your post I set Datagrid's enableViewState to false, and it works
now. When I set ViewState again to true it stops to work. Maybe you know why ?
Jarod
 
With the Datagrid's ViewState set to false, you should have problem with
things like automatic paging. Without the source code, I cannot tell you
anything more. It is possible, for example, that you are binding your
datagrid to many times or at the wrong place.

Maybe by taking a look at the trace.axd output, you will see what's the
problem.

S. L.
 
I am wondering if u can post up a few lines of code.

did you really managed to compile "this.dgMydata +=.."
statement?
usually it look something like "DataGrid1.ItemCommand
+=..."

Joey
 
With the Datagrid's ViewState set to false, you should have problem with
things like automatic paging. Without the source code, I cannot tell you
anything more. It is possible, for example, that you are binding your
datagrid to many times or at the wrong place.

Maybe by taking a look at the trace.axd output, you will see what's the
problem.
I bind datagrid only once at page load. There is no other databinding.
Jarod
 
Back
Top