D
Dale
I just edited about 12 DataGrids on as many pages to update the look and feel
to current company standards. One thing I did was replace LinkButtons with
PushButtons. On all of the DataGrids, I simply edited the Text attribute to
the current requirement and then added a ButtonType=PushButton attribute.
On the first 11, this worked flawlessly. On the very last one, it bombed.
The PushButton would post back but no event handler would be called. The
CommandName attribute of the buttons is "Cancel" yet neither the ItemCommand
nor the CancelCommand event would fire. Form["__EVENTTARGET"] and
Form["__EVENTARGUMENT"] are both null.
All I had to do is take out the ButtonType=PushButton attribute and the
events would fire as expected.
This code works:
<asp:datagrid id="flagList" runat="server" AutoGenerateColumns="False"
AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="#CFCFCF"
HeaderStyle-ForeColor="black" HeaderStyle-Font-Bold="True"
OnItemDataBound="flagList_ItemDataBound" CellPadding="3" Font-Size="X-Small"
DataKeyField="name" BorderColor="DarkGray">
<Columns>
<asp:ButtonColumn Text="<img src=images/cancel.gif border=0 alt='Cancel'>"
HeaderText="Cancel Job" CommandName="Cancel">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
And this code does not (The datagrid declaration is the same as above so I
am only showing the different ButtonColumn declaration):
<asp:ButtonColumn Text="Cancel" HeaderText="Cancel Job" CommandName="Cancel">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
If I have both versions in the code, the original version still works and
the PushButton version does not work.
Any suggestions?
Thanks,
Dale
to current company standards. One thing I did was replace LinkButtons with
PushButtons. On all of the DataGrids, I simply edited the Text attribute to
the current requirement and then added a ButtonType=PushButton attribute.
On the first 11, this worked flawlessly. On the very last one, it bombed.
The PushButton would post back but no event handler would be called. The
CommandName attribute of the buttons is "Cancel" yet neither the ItemCommand
nor the CancelCommand event would fire. Form["__EVENTTARGET"] and
Form["__EVENTARGUMENT"] are both null.
All I had to do is take out the ButtonType=PushButton attribute and the
events would fire as expected.
This code works:
<asp:datagrid id="flagList" runat="server" AutoGenerateColumns="False"
AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="#CFCFCF"
HeaderStyle-ForeColor="black" HeaderStyle-Font-Bold="True"
OnItemDataBound="flagList_ItemDataBound" CellPadding="3" Font-Size="X-Small"
DataKeyField="name" BorderColor="DarkGray">
<Columns>
<asp:ButtonColumn Text="<img src=images/cancel.gif border=0 alt='Cancel'>"
HeaderText="Cancel Job" CommandName="Cancel">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
And this code does not (The datagrid declaration is the same as above so I
am only showing the different ButtonColumn declaration):
<asp:ButtonColumn Text="Cancel" HeaderText="Cancel Job" CommandName="Cancel">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:ButtonColumn>
If I have both versions in the code, the original version still works and
the PushButton version does not work.
Any suggestions?
Thanks,
Dale