我有一个嵌入在datagridview页脚内的asp.net向导控件的以下代码片段,它完全可以根据我的需要工作。它仍然可以在Firefox,Chrome和Opera中正确呈现,但在升级到IE 10时整个向导是失真。
我们的大多数客户都是IE狂热者。等。
我标记了向导所在的模板字段
<asp:TemplateField HeaderText="ISCID">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" SortExpression="ISCID" Text='<%# Eval("ISCID") %>' ReadOnly="true" />
</ItemTemplate>
<FooterTemplate>
<asp:Panel runat="server" ID="FooterMessagePanel1" Style="text-align: center" Wrap="False">
<asp:Label runat="server" ID="LabelFooterMessage1" Text="Click the + button to initiate a new transfer" />
</asp:Panel>
<asp:Panel runat="server" ID="TransferWizardPanel" Style="display: none" Width="100%" Wrap="False">
<asp:Wizard ID="TransferWizard" DisplayCancelButton="true" runat="server" HeaderText="Share transfer Wizard"
HeaderStyle-Font-Size="Larger"
HeaderStyle-CssClass="CaptionLabelGVsm"
OnFinishButtonClick="TransferWizard_FinishButtonClick"
OnCancelButtonClick="TransferWizard_CancelButtonClick"
OnActiveStepChanged="TransferWizard_ActiveStepChanged"
StepNextButtonType="Image"
StepNextButtonImageUrl="~/images/Next16.png"
StepPreviousButtonType="Image"
StepPreviousButtonImageUrl="~/images/Previous16.png"
CancelButtonType="Image"
CancelButtonImageUrl="~/images/Cancel16.png"
ActiveStepIndex="0" Width="100%">
<SideBarTemplate>
<asp:DataList ID="SideBarList" runat="server" OnItemDataBound="SideBarList_ItemDataBound" HorizontalAlign="Justify" RepeatDirection="Horizontal">
<ItemTemplate>
<asp:LinkButton ID="SideBarButton" ForeColor="Black" runat="server" CssClass="MenuBar"></asp:LinkButton>
</ItemTemplate>
</asp:DataList>
</tr><tr>
</SideBarTemplate>
<StartNavigationTemplate>
<asp:Panel ID="panStart" runat="server">
<asp:ImageButton runat="server" ID="imgStart" ImageUrl="~/images/Next16.png"
CommandName="MoveNext" />
<asp:ImageButton ID="startCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/images/Edit_UndoHS.png" OnClientClick="return confirm('Are you sure you want to cancel');" />
</asp:Panel>
</StartNavigationTemplate>
<StepNavigationTemplate>
<asp:ImageButton ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious" ImageUrl="~/images/Previous16.png" />
<asp:ImageButton ID="StepNextButton" runat="server" CausesValidation="true" CommandName="MoveNext" ImageUrl="~/images/Next16.png" />
<asp:ImageButton ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/images/Edit_UndoHS.png" />
</StepNavigationTemplate>
<FinishNavigationTemplate>
<asp:ImageButton ID="FinishButton" runat="server" CausesValidation="False" CommandName="MoveComplete" ImageUrl="~/images/Finish16.png" />
</FinishNavigationTemplate>
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Transferor Details">
<asp:Panel runat="server" ID="TransferFromAllotmentsPanel" Style="display: none">
<table class="TableControlGV" style="width: 100%">
<tr>
<td class="LabelColumnGV" style="text-align: left">Class</td>
<td class="DescColumnGV">
<asp:TextBox ID="AllotClassGVDDList" Width="100%" runat="server" CssClass="classInput" ReadOnly="False" />
<asp:RequiredFieldValidator ID="RequiredFieldValidatorAllotClass" runat="server" ControlToValidate="AllotClassGVDDList" Text="" InitialValue=""
Display="Dynamic" ErrorMessage="Enter share class"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
<table class="TableControlGV" style="width: 100%">
<tr>
<td colspan="6" class="CaptionLabelGVsm" style="text-align: left">Avalaible Certificates</td>
</tr>
<tr>
<td style="width: 100%">
<asp:GridView ID="TrnsfreeWizardGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="ISCID,ClassCode"
CssClass="grid" Width="100%" OnRowEditing="TrnsfreeWizardGridView_RowEditing"
EnableModelValidation="True" ShowFooter="False">
<RowStyle CssClass="GridViewRow" />
<SelectedRowStyle CssClass="GridViewRowSelected" />
<EditRowStyle BackColor="Azure" />
<EditRowStyle CssClass="GridViewRowEdit" />
<AlternatingRowStyle CssClass="GridViewRowAlt" />
<Columns>
</Columns>
<EmptyDataTemplate>
</EmptyDataTemplate>
<FooterStyle CssClass="CaptionLabelGVsm" />
</asp:GridView>
</td>
</tr>
</table>
</asp:Panel>
</asp:WizardStep>
<asp:WizardStep ID="WizadStep2" runat="server" Title="Transfer Details">
<asp:Panel ID="NewTransferPanel" runat="server" Style="display: block" Width="100%">
</asp:Panel>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep3" runat="server" Title="Transfer Summary" OnActivate="WizardStep2_Activate">
<asp:Panel ID="TransferSummaryPanel" runat="server">
<asp:GridView ID="GridViewSummary" runat="server" AutoGenerateColumns="False" CssClass="grid">
<Columns>
<asp:BoundField HeaderText="Date" DataField="TransDate" />
<asp:BoundField HeaderText="Transferor" DataField="Transferor" />
<asp:BoundField HeaderText="Transferee" DataField="Transferee" />
<asp:BoundField HeaderText="Class" DataField="ShareClass" />
<asp:BoundField HeaderText="OldCertNo" DataField="OldCertNumber" />
<asp:BoundField HeaderText="NewCertNo" DataField="NewCertNumber" />
<asp:BoundField HeaderText="Amount" DataField="Amount" />
<asp:BoundField HeaderText="Shares" DataField="Shares" />
</Columns>
</asp:GridView>
</asp:Panel>
</asp:WizardStep>
<asp:WizardStep ID="WizardStep4" runat="server" Title="Transfer Complete">
<asp:Panel ID="PanelComplete" runat="server" Style="display: block">
<asp:Label ID="LabelMessage" runat="server" Text="Share transfer completed successfully<br>Click Finish to exit wizard or new to add a new transfer"></asp:Label>
<asp:ImageButton ID="ButtonNew" runat="server" Text="New Transfer" OnClick="ButtonNew_Click" ImageUrl="~/images/add.png" />
</asp:Panel>
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
</asp:Panel>
</FooterTemplate>
</asp:TemplateField>
我一直在努力纠正这个问题但是我的所有尝试都被顽固的IE10挫败了。请帮助我阻止自己撞到墙上。侧边栏模板中不寻常的tr打开和关闭标签是一个hack(加入此论坛)强制侧边栏菜单水平运行,似乎不是渲染问题的根源。
提前致谢
答案 0 :(得分:1)
Eureka !!!!。我发现IE10未能覆盖行创建的事件上设置的初始宽度。将此代码段放在datagridview的行数据绑定事件中,
If e.Row.RowType = DataControlRowType.Footer Then
If Request.Browser.Type = "IE7" Then
e.Row.Cells(1).Width = 800
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
End if
End if
我的问题解决了。 奇怪的是IE10浏览器类型在Visual Studio 2012中被检测为IE7。