HighTechTalks DotNet Forums  

Datagrid EnableViewState OnItemCommand Problems

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss Datagrid EnableViewState OnItemCommand Problems in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Datagrid EnableViewState OnItemCommand Problems - 06-11-2006 , 06:30 AM






Hi

I disable the view state within my datagrids using the code below...

private void Page_PreRender(object sender, EventArgs e) {
foreach (DataGridItem dataGridItem in dgdData.Items)
dgdData.EnableViewState = false;
}

I also always include the add and details buttons to the datagrid
within a template column as below...

<asp:TemplateColumn>
<HeaderTemplate>
<asp:Button ID="btnAdd" runat="Server"
CommandName="Add" Style="width: 50px" Text="Add" />
</HeaderTemplate>
<ItemTemplate>
<asp:Button ID="btnDetails" runat="Server"
CommandName="Details" Style="width: 50px" Text="Details" />
</ItemTemplate>
</asp:TemplateColumn>

The problem that I am experiencing is that for some data grid views,
clicking on a button results in a postback and a call to the oncommand
member function, but not to the prerender. This is as expected.

For others, the postback is called, the oncommand member function is
not called, but the prerender function is. This seems bizarre.

Has anyone else come across this. Is is a Microsoft bug?

Regards

James


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.