问题
I am using Ajax ToggleButtonExtender to show check and uncheck images for 2 columns of check boxes. These are in a GridView within a Panel. They display and work fine until the number of rows in the GridView exceeds the size of the Panel, at which time the Panel scrolls, but the ToggleButtonExtender images continue to display below the Panel, and when I scroll the Panel the images stay where they are so do not aline with the other columns in the GridView. Any ideas?
Heres my code :
<asp:Panel id="PanelMM" cssclass="G4panl2m" runat="Server" ScrollBars="Auto">
<asp:GridView id="GridViewMM" cssclass="gridTMAnc1" runat="server"
AutoGenerateColumns="False" DataKeyNames="AnimalID" GridLines="Vertical" ShowHeader="False" >
<RowStyle Height="10px" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkStatusMM" runat="server"
OnCheckedChanged="chkStatusMM_OnCheckedChanged" AutoPostBack="True" Width="11" Height="11" />
<asp:ToggleButtonExtender ID="tbeMM" runat="server"
TargetControlID="chkStatusMM" ImageWidth="14" ImageHeight="14"
CheckedImageAlternateText="Check" UncheckedImageAlternateText="Click to keep animal"
UncheckedImageUrl="~/images/greentick.jpg" CheckedImageUrl="~/images/blankcheckbox.jpg" >
</asp:ToggleButtonExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkStatusMM2" runat="server"
OnCheckedChanged="chkStatusMM2_OnCheckedChanged" AutoPostBack="True" Height="11" Width="11" />
<asp:ToggleButtonExtender ID="tbeMM2" runat="server"
TargetControlID="chkStatusMM2" ImageWidth="11" ImageHeight="11"
CheckedImageAlternateText="Check" UncheckedImageAlternateText="Click to remove animal"
UncheckedImageUrl="~/images/redcross.jpg" CheckedImageUrl="~/images/blankcheckbox.jpg" >
</asp:ToggleButtonExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Name" HeaderText="Name" >
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="AnimalID" HeaderText="ID" Visible="False" />
</Columns>
</asp:GridView>
</asp:Panel>
来源:https://stackoverflow.com/questions/7720594/togglebuttonextender-image-display-issue