2011-11-04 49 views
0

這更像是我想知道爲什麼。鏈接按鈕可在Firefox和Chrome中使用,但不能在IE-8中使用。
編輯: 圖工作在IE-7而不是8在按鈕周圍存在div時,Linkbuttons無法在IE中工作

現在,如果你刪除

<div> 
</div> 

然後所有的鏈接正常工作。任何人都知道原因

AXPX PAGE

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="testPage.aspx.cs" Inherits="MyCompany.WEB.Pages.Secured.testPage" MasterPageFile="~/Layouts/Branding.Master" Theme="Default" %> 
<%@ Register Assembly="DBauer.Web.UI.WebControls.DynamicControlsPlaceholder" Namespace="DBauer.Web.UI.WebControls" TagPrefix="DBWC" %> 
<%@ Register TagPrefix="MyCompany" TagName="Toolbar" Src="~/Controls/ToolbarViewer.ascx" %> 

<asp:Content ID="conToolbar" runat="server" ContentPlaceHolderID="cphToolbar"> 
<MyCompany:Toolbar ID="incToolbar" runat="server" /> 
</asp:Content> 
<asp:Content ID="conHome" runat="server" ContentPlaceHolderID="cphMain"> 
<asp:ListView ID="lvProducts" runat="server" OnItemDataBound="lvProducts_ItemDataBound"> 

    <EmptyDataTemplate>There are no primary UITs</EmptyDataTemplate> 
    <LayoutTemplate> 
      <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder> 
    </LayoutTemplate> 

    <ItemTemplate> 
     <asp:UpdatePanel ID="pnlMainUpdate" runat="server" UpdateMode="Conditional" > 
     <ContentTemplate > 
     <asp:Repeater ID="rptLineItems" runat="server" OnItemDataBound="rptLineItems_ItemDataBound" > 
      <ItemTemplate> 
      <asp:Panel runat="server" ID="pnLineItem" CssClass="Block ClearBoth UITOrderGroup Ledger OrderBorder FloatLeft UITOrderHeight"> 
      <asp:LinkButton ID="lnkAddRow" runat="server" CssClass="IconButton Block Add" style="width:20px;" ToolTip="Add Row" CommandName="AddItem" OnCommand="lnkRow_Command" ></asp:LinkButton> 
      </asp:Panel> 
      </ItemTemplate> 
     </asp:Repeater> 
     </ContentTemplate> 
     </asp:UpdatePanel> 

    </ItemTemplate> 
</asp:ListView> 

<div class="floatRight"> 
    <asp:button ID="btnSubmit" runat="server" CssClass="DefaultButton floatRight" Text="Order" ToolTip="Click here to Order" Visible="true"></asp:button> 
</div> 

</asp:Content> 

後面的代碼

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 

namespace MyCompany.WEB.Pages.Secured 
{ 
    public partial class testPage : MyCompanyPageBase 
    { 
     protected void Page_Load(object sender, EventArgs e) 
     { 
      lvProducts.DataSource = new List<int>() {1,2,4,5,6}; 
      lvProducts.DataBind(); 
     } 
    protected void lvProducts_ItemDataBound(object sender, ListViewItemEventArgs e) 
    { 
     var dataItem = (ListViewDataItem)e.Item; 
     var rptLineItems = (Repeater)dataItem.FindControl("rptLineItems"); 
     rptLineItems.DataSource = new List<int> { 1,2,3,4,5 }; 
     rptLineItems.DataBind(); 
    } 
    protected void lnkRow_Command(object sender, CommandEventArgs commandEventArgs) 
    { } 
    protected void rptLineItems_ItemDataBound(object sender, RepeaterItemEventArgs e) 
    { 
    } 
} 
} 

回答

0

事實證明,您必須爲列表視圖中的控件設置Text屬性。

<ItemTemplate> 
     <asp:Panel runat="server" ID="pnLineItem" CssClass="Block ClearBoth UITOrderGroup Ledger OrderBorder FloatLeft UITOrderHeight"> 
     <asp:LinkButton ID="lnkAddRow" runat="server" CssClass="IconButton Block Add" style="width:20px;" ToolTip="Add Row" CommandName="AddItem" OnCommand="lnkRow_Command" Text="" ></asp:LinkButton> 
     </asp:Panel> 
     </ItemTemplate> 
0

我懷疑你的風格是造成LinkButton不正確呈現。從Panel中刪除CssClass財產,看看是否有所作爲。

在調試此問題時,我會暫時刪除UpdatePanel。在沒有AJAX的情況下調試這些類型的問題會更容易。

+0

不,它沒有。儘管我沒有厭倦刪除更新面板。 – Bitmask