views:

242

answers:

1

I'm trying to add a couple of buttons on each row in this datagrid of a legacy ASP.net app.

Here's the code:

<asp:datagrid id="dgView" style="Z-INDEX: 101; LEFT: 0px; POSITION: absolute; TOP: 0px" runat="server" Width="100%" BorderColor="Black" AllowPaging="True" PageSize="8">
 <AlternatingItemStyle Font-Size="XX-Small" Font-Names="Verdana" HorizontalAlign="Center" VerticalAlign="Bottom">
 </AlternatingItemStyle>
 <ItemStyle Font-Size="XX-Small" Font-Names="Verdana" Wrap="False" HorizontalAlign="Center" Height="20px" ForeColor="Black" VerticalAlign="Bottom" BackColor="White"></ItemStyle>
 <HeaderStyle Font-Size="X-Small" Font-Names="Verdana" Font-Bold="True" HorizontalAlign="Center" Height="20px" ForeColor="#990033" VerticalAlign="Middle" BackColor="LightGray"></HeaderStyle>
 <PagerStyle Height="20px" Mode="NumericPages"></PagerStyle>
 <Columns>
  <asp:ButtonColumn ButtonType="PushButton" Text="Reprocess" CommandName="Reprocess">
  <ItemStyle Font-Size="XX-Small" Font-Bold="True" ForeColor="Blue"></ItemStyle>
  </asp:ButtonColumn>
  <asp:ButtonColumn ButtonType="PushButton" Text="Suppress" CommandName="Suppress">
  <ItemStyle Font-Size="XX-Small" Font-Bold="True" ForeColor="Blue"></ItemStyle>
  </asp:ButtonColumn>
 </Columns>
</asp:datagrid>

Here's the resulting grid: alt text

The rest of the columns come from the databound recordset. I don't want to spend any time on this except for whatever it takes to add this button, I've only been given a day or so to add some functionality before I have to move on. When I take off the "Suppress" button, the "Reprocess" button becomes visible, but it seems like only one at a time can be visible. What could be the issue?

A: 

Are you sure it's not rendering at all? Possibly it's just hidden. Check the HTML source.

How are the rest of the columns being generated? It looks like they are being auto-generated... what happens if you set AutoGenerateColumns="false"? You'll probably just get the two ButtonColumn columns, eh?

Bryan
accepted on spirit of "are you sure you're not doing something stupid?", because while it wasn't one of those specific things, it was something else stupid :)
Chris McCall