Home All Groups Group Topic Archive Search About
Author
10 Feb 2005 11:09 PM
Scott M.
I have an asp:DataGrid control with EnableViewState=False.  I am calling
DataBind on both the non-postback and the postback.  I am persisting the
state of the grid myself and restoring the state (selectedItem, editItem,
sortCommand, etc.).  Everything is working just fine EXCEPT the
CancelCommand event is not firing.  All the other events ARE firing.

Any ideas?

Author
11 Feb 2005 2:10 AM
Elton Wang
Show your code please.

Elton Wang
elton_w***@hotmail.com

>-----Original Message-----
>I have an asp:DataGrid control with
EnableViewState=False.  I am calling
Show quoteHide quote
>DataBind on both the non-postback and the postback.  I am
persisting the
>state of the grid myself and restoring the state
(selectedItem, editItem,
>sortCommand, etc.).  Everything is working just fine
EXCEPT the
>CancelCommand event is not firing.  All the other events
ARE firing.
>
>Any ideas?
>
>
>
>.
>
Author
11 Feb 2005 2:56 AM
Scott M.
Private Sub dg_CancelCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg.CancelCommand

    dg.EditItemIndex = -1
    dg.DataBind()

End Sub

SortCommand event fires, PageIndexChanged event fires, SelectedIndexChanged
event fires, EditCommand fires, CancelCommand does not but it does have the
correct Handles clause.


Show quoteHide quote
"Elton Wang" <anonym***@discussions.microsoft.com> wrote in message
news:032d01c50fde$ed6235c0$a501280a@phx.gbl...
> Show your code please.
>
> Elton Wang
> elton_w***@hotmail.com
>
>>-----Original Message-----
>>I have an asp:DataGrid control with
> EnableViewState=False.  I am calling
>>DataBind on both the non-postback and the postback.  I am
> persisting the
>>state of the grid myself and restoring the state
> (selectedItem, editItem,
>>sortCommand, etc.).  Everything is working just fine
> EXCEPT the
>>CancelCommand event is not firing.  All the other events
> ARE firing.
>>
>>Any ideas?
>>
>>
>>
>>.
>>
Author
11 Feb 2005 2:13 PM
Elton Wang
Unfortunately once you disable ViewState of the datagrid,
it seems the system can't correctly transfer link button
name, no matter you click Edit, or Cancel, or Update
button, it only gives Edit. Hence it only fires Edit
(selectedItem, SortCommand are not affected).

HTH,

Elton Wang
elton_w***@hotmail.com


>-----Original Message-----
>I have an asp:DataGrid control with
EnableViewState=False.  I am calling
Show quoteHide quote
>DataBind on both the non-postback and the postback.  I am
persisting the
>state of the grid myself and restoring the state
(selectedItem, editItem,
>sortCommand, etc.).  Everything is working just fine
EXCEPT the
>CancelCommand event is not firing.  All the other events
ARE firing.
>
>Any ideas?
>
>
>
>.
>
Author
11 Feb 2005 10:17 PM
Scott M.
I'm afraid that analysis is incorrect. I'm not using LinkButton controls
anyway and (as I mentioned) all other events are firing properly except the
CancelCommand event.

Show quoteHide quote
"Elton Wang" <anonym***@discussions.microsoft.com> wrote in message
news:151601c51043$dcc52cd0$a401280a@phx.gbl...
> Unfortunately once you disable ViewState of the datagrid,
> it seems the system can't correctly transfer link button
> name, no matter you click Edit, or Cancel, or Update
> button, it only gives Edit. Hence it only fires Edit
> (selectedItem, SortCommand are not affected).
>
> HTH,
>
> Elton Wang
> elton_w***@hotmail.com
>
>
>>-----Original Message-----
>>I have an asp:DataGrid control with
> EnableViewState=False.  I am calling
>>DataBind on both the non-postback and the postback.  I am
> persisting the
>>state of the grid myself and restoring the state
> (selectedItem, editItem,
>>sortCommand, etc.).  Everything is working just fine
> EXCEPT the
>>CancelCommand event is not firing.  All the other events
> ARE firing.
>>
>>Any ideas?
>>
>>
>>
>>.
>>
Author
13 Feb 2005 4:06 PM
Elton Wang
Although you aren't explicitly using linkButton, you are
actually using it when you are using EditCommandColumn.
Why don't you create ItemCommand event and debug into the
event to see what happens?

Elton Wang

>-----Original Message-----
>I'm afraid that analysis is incorrect. I'm not using
LinkButton controls
>anyway and (as I mentioned) all other events are firing
properly except the
Show quoteHide quote
>CancelCommand event.
>
>"Elton Wang" <anonym***@discussions.microsoft.com> wrote
in message
>news:151601c51043$dcc52cd0$a401280a@phx.gbl...
>> Unfortunately once you disable ViewState of the
datagrid,
>> it seems the system can't correctly transfer link button
>> name, no matter you click Edit, or Cancel, or Update
>> button, it only gives Edit. Hence it only fires Edit
>> (selectedItem, SortCommand are not affected).
>>
>> HTH,
>>
>> Elton Wang
>> elton_w***@hotmail.com
>>
>>
>>>-----Original Message-----
>>>I have an asp:DataGrid control with
>> EnableViewState=False.  I am calling
>>>DataBind on both the non-postback and the postback.  I
am
>> persisting the
>>>state of the grid myself and restoring the state
>> (selectedItem, editItem,
>>>sortCommand, etc.).  Everything is working just fine
>> EXCEPT the
>>>CancelCommand event is not firing.  All the other events
>> ARE firing.
>>>
>>>Any ideas?
>>>
>>>
>>>
>>>.
>>>
>
>
>.
>
Author
13 Feb 2005 5:15 PM
Scott M.
I really don't think the linkButton is being used as I have configured the
grid to use a Web Forms Button instead of a linkButton.

I could debug the ItemCreated event, but that would tell me what I already
know...that the CancelCommand is not firing.

I'm not trying to diagnose...I have the diagnosis, what I'm looking for is
the cure.

Thank you anyway.


Show quoteHide quote
"Elton Wang" <anonym***@discussions.microsoft.com> wrote in message
news:292901c511e5$f8320da0$a601280a@phx.gbl...
> Although you aren't explicitly using linkButton, you are
> actually using it when you are using EditCommandColumn.
> Why don't you create ItemCommand event and debug into the
> event to see what happens?
>
> Elton Wang
>
>>-----Original Message-----
>>I'm afraid that analysis is incorrect. I'm not using
> LinkButton controls
>>anyway and (as I mentioned) all other events are firing
> properly except the
>>CancelCommand event.
>>
>>"Elton Wang" <anonym***@discussions.microsoft.com> wrote
> in message
>>news:151601c51043$dcc52cd0$a401280a@phx.gbl...
>>> Unfortunately once you disable ViewState of the
> datagrid,
>>> it seems the system can't correctly transfer link button
>>> name, no matter you click Edit, or Cancel, or Update
>>> button, it only gives Edit. Hence it only fires Edit
>>> (selectedItem, SortCommand are not affected).
>>>
>>> HTH,
>>>
>>> Elton Wang
>>> elton_w***@hotmail.com
>>>
>>>
>>>>-----Original Message-----
>>>>I have an asp:DataGrid control with
>>> EnableViewState=False.  I am calling
>>>>DataBind on both the non-postback and the postback.  I
> am
>>> persisting the
>>>>state of the grid myself and restoring the state
>>> (selectedItem, editItem,
>>>>sortCommand, etc.).  Everything is working just fine
>>> EXCEPT the
>>>>CancelCommand event is not firing.  All the other events
>>> ARE firing.
>>>>
>>>>Any ideas?
>>>>
>>>>
>>>>
>>>>.
>>>>
>>
>>
>>.
>>
Author
22 Feb 2005 9:19 PM
quang.lai
"Elton Wang" <anonym***@discussions.microsoft.com> wrote in message news:<151601c51043$dcc52cd0$a401280a@phx.gbl>...
> Unfortunately once you disable ViewState of the datagrid,
> it seems the system can't correctly transfer link button
> name, no matter you click Edit, or Cancel, or Update
> button, it only gives Edit. Hence it only fires Edit
> (selectedItem, SortCommand are not affected).

I'm having a similar problem and just noticed what you mentioned.  Is
there a known work around for this?

When I enable ViewState for my dataGrid, I get the "Failed to load
viewState" when any action is done on the first row of my datagrid.
JUST the first row.  I can modify and manipulate any other row and I
won't get the "Failed to load viewState" error.  I'm not dynamically
adding/deleting any controls either.

What are my options?

Thanks