开发者

ASP.net datagrid, adding two buttoncolumns, only one showing up

开发者 https://www.devze.com 2022-12-10 18:24 出处:网络
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:

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">
 <AlternatingIt开发者_C百科emStyle 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 http://img255.imageshack.us/img255/3442/gridview.png

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?


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号