簡體   English   中英

圖像按鈕在更新面板中不起作用

[英]Image Button not working in update panel

我在更新面板中使用了圖像按鈕來顯示圖像。 它在本地工作正常,但是當我將其托管在服務器中時,IE瀏覽器在單擊“圖像”按鈕后無法顯示圖像。

Firfox和chrome可以正常工作,但IE 10.0.11。

   <asp:UpdatePanel ID="upBanners" UpdateMode="Always" runat="server">
    <ContentTemplate>

    <table class="tab_nobr" border="0" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <th><asp:Label ID="lblCategory" runat="server"  Text="<%$Resources:Default, Category %>"></asp:Label></th>
            <th>
                <asp:DropDownList ID="ddlCategory" runat="server">
                    <asp:ListItem Text="DubLi.com" Value="DubLi.com" Selected="True"></asp:ListItem>
                    <asp:ListItem Text="Network" Value="Network"></asp:ListItem>
                    <asp:ListItem Text="Partner Program" Value="Partner Program"></asp:ListItem>
                    <asp:ListItem Text="Christmas Banners" Value="Xmas"></asp:ListItem>
                </asp:DropDownList> 
            </th>
            <th><asp:Label ID="lblLang" runat="server" Text="<%$Resources:Default, Language %>"></asp:Label></th>
            <th>
                <asp:DropDownList ID="ddlLanguage" runat="server"></asp:DropDownList>   
            </th>
            <th><asp:ImageButton ID="imgGO" runat="server" AlternateText="GO" ImageUrl="~/Images/button_go.gif" OnClick="OnBannerOptionChanged"/></th>
            <th class="p100">&nbsp;</th>
            <th></th>
        </tr>
    </tbody>
</table>

<div class="bannerview_first">
<asp:GridView ID="grdViewBanner" runat="server" GridLines="None" Width="100%" AutoGenerateColumns="false" ShowHeader="false" BorderStyle="None" BorderWidth="0" CellPadding="0" CellSpacing="0">
    <Columns>
        <asp:TemplateField HeaderText="">
            <ItemTemplate>
                <div class="bannerview">
                    <img id="imgBannerSrc" runat="server" alt="" src='<%# Eval("ImageURL") %>' /><br />
                    <span><label ID="lblTitle" runat="server"><%# Eval("Title") %> : </label></span><label ID="lblTitleVal" runat="server"><%# Eval("TitleVal") %></label><br/>
                    <span><label ID="lblDimension" runat="server"><%# Eval("Dimension") %> : </label></span><label ID="lblDimensionVal" runat="server"><%# Eval("DimensionVal") %></label><br/>
                    <span><label ID="lblCode" runat="server"><%# Eval("Code") %> : </label></span> 
                    <pre class="code" style="white-space:normal" ><%# Eval("CodeVal") %></pre>
                    <div style="clear: both;"/>
                </div>
            </ItemTemplate>
        </asp:TemplateField>
     </Columns>
</asp:GridView>
</div>       </ContentTemplate>  </asp:UpdatePanel>

C#代碼如下:

  public void OnBannerOptionChanged(object sender, EventArgs e)
    {
        //Get the selected category and then the selected Language Values...
        string cat = this.ddlCategory.SelectedItem.Value;
        string lang = this.ddlLanguage.SelectedItem.Value;

        //Now cosntruct the directory structure...
        string dirStruct = "Banner/" + cat + "/" + lang;
        string dirStructPath = MapPath("~/" + dirStruct);
        if (Directory.Exists(dirStructPath))
        {
            BindBannerGrid(dirStruct);
            this.grdViewBanner.Visible = true;
        }
        else
        {
            this.grdViewBanner.Visible = false;
        }
    }

在本地,所有瀏覽器都可以正常工作,但是在服務器上有問題,並且僅不工作IE

提前致謝!!

我已經解決了這只是將Imagebutton替換為LinkBut​​ton :)

<asp:LinkButton ID="imgGO" runat="server" Text="Button" AlternateText="GO" ImageUrl="~/Images/button_go.gif" OnClick="OnBannerOptionChanged"><img src="/Images/button_go.gif" alt="" /></asp:LinkButton>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM