我用链接按钮调用转发器内的ajax下拉列表。 DropDown列表在IE中填充,但该值未被选中,因此ItemCommn并未被触发.IE无法理解选择了下拉值,同样的事情在Google中工作正常
我的前端代码是:
<asp:UpdatePanel ID="upPaymentRefund" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false" EnableViewState="true" >
<ContentTemplate>
<div class="row">
<div class="left heading-column">Cards on file:</div>
<div class="left form-wide-column-left">
<asp:Label ID="lblCardsonfile" runat="server"
Style="display:block; width:100px; padding:2px; padding-right:50px; font-family:Arial; font-size:11px;"
Text="Select card on file"></asp:Label>
<asp:Panel ID="panelCardsOnFile" runat="server"
CssClass="ContextMenuPanel" Style="display:none; visibility:hidden; ">
<asp:Repeater ID="rptCardsOnFile" runat="server" EnableViewState="true"
OnItemCommand="rptCardsOnFile_ItemCommand">
<ItemTemplate>
<asp:LinkButton ID="lblCardsonfile" runat="server" CausesValidation="false" style="z-index:20000"
CssClass="ContextMenuItem" CommandName="Select" OnClientClick="alert('hi')"
CommandArgument='<%# Eval("customerCards") %>'
Text='<%# Eval("UseInDropDown") %>' />
</ItemTemplate>
</asp:Repeater>
</asp:Panel>
<cc1:DropDownExtender ID="ddeCardsOnFile" runat="server"
DropDownControlID="panelCardsOnFile"
TargetControlID="lblCardsonfile" ></cc1:DropDownExtender>
<asp:HiddenField ID="hfCCInfo" Value="" runat="server" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
我在代码隐藏文件中有以下事件:
绑定转发器 protected void Page_Load(object sender,EventArgs e) {
if (!Page.IsPostBack)
{
using (dbUtil db = new dbUtil())
{
db.ConnectDB();
SqlCommand cmd = new SqlCommand("getCustomerCards " + customerID.ToString(), db.Connection);
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.HasRows)
{
//while (rdr.Read())
//{
//string data = rdr["customerCards"].ToString() ;
//string[] itemized = data.Split(new char[] { '|' });
//}
}
this.rptCardsOnFile.DataSource = rdr;
this.rptCardsOnFile.DataBind();
}
}
}
转发器的ItemCommand
protected void rptCardsOnFile_ItemCommand(object source,RepeaterCommandEventArgse){
this.ddlCardType.SelectedIndex = -1;
this.ddlExpMonth.SelectedIndex = -1;
this.ddlExpYear.SelectedIndex = -1;
}
答案 0 :(得分:0)
这个问题似乎是由于缺少DOCTYPE而发生的,因此IE转换页面的IE5 / IE7兼容模式。您可以在webform中添加DOCTYPE,如下所示 -
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="$fileinputname$.aspx.cs" Inherits="$rootnamespace$.$classname$" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head runat="server">
<title></title>
</head>
<body>
</body>
</html>
如果您遇到问题,可以查看本教程HERE