ajax的多个实例:单个页面上的组合框无法正常工作

时间:2013-08-03 06:50:28

标签: asp.net ajaxcontroltoolkit

我的网络表单上有4 ajaxToolkit:ComboBox。 在页面加载事件中,我已填充所有4 combo-boxes。 但我的页面只显示了一个combo-box和3个text-boxes

Aspx页码

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <ajaxToolkit:ToolkitScriptManager runat="server" ID="ScriptManager1" EnablePageMethods="true" />
    <table frame="void" class="tblTable">
        <tr>
            <td style="width:100px;">
                <asp:Label ID="lblServer" CssClass="lbl" runat="server" Text="Server:"></asp:Label>
            </td>
            <td >
                <ajaxToolkit:ComboBox ID="ddlServer" runat="server" DropDownStyle="DropDownList" CaseSensitive="false" 
                        AutoCompleteMode="SuggestAppend" CssClass="" AppendDataBoundItems="false" >
                </ajaxToolkit:ComboBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblOriginating" CssClass="lbl" runat="server" Text="Originating:"></asp:Label>
            </td>
            <td>
                <ajaxToolkit:ComboBox ID="ddlOrg" runat="server" DropDownStyle="DropDownList" CaseSensitive="false"
                        AutoCompleteMode="SuggestAppend" CssClass="" AppendDataBoundItems="false">
                </ajaxToolkit:ComboBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblTerminating" CssClass="lbl" runat="server" Text="Terminating:"></asp:Label>
            </td>
            <td>
                <ajaxToolkit:ComboBox ID="ddlTer" runat="server" DropDownStyle="DropDownList" CaseSensitive="false"
                        AutoCompleteMode="SuggestAppend" CssClass="" AppendDataBoundItems="false">
                </ajaxToolkit:ComboBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblDestination" CssClass="lbl" runat="server" Text="Destination:"></asp:Label>
            </td>
            <td>
                <ajaxToolkit:ComboBox ID="ddlDest" runat="server" DropDownStyle="DropDownList" CaseSensitive="false"
                        AutoCompleteMode="SuggestAppend" CssClass="" AppendDataBoundItems="false">
                </ajaxToolkit:ComboBox>
            </td>
        </tr>
    </table>
    </div>
    </form>
</body>
</html>

服务器端代码

protected void Page_Load(object sender, EventArgs e)
{
    DataSet ds = new DataSet();
    string ServerID = ddlServer.SelectedValue;
    ds = clsTransaction.Select(@"SELECT wsid AS ID,nm AS Name FROM tblwser ORDER BY nm;
SELECT acid AS ID,nm AS Name FROM tblReseller WHERE wsid = '" + ServerID + @"' ORDER BY nm;
SELECT acid AS ID,nm AS Name FROM tblReseller WHERE wsid = '" + ServerID + @"' ORDER BY nm;
SELECT destid AS ID,destname AS Name FROM tbldestination WHERE wsid = '" + ServerID + "' ORDER BY destname",
            DataSendBSSWEB.ServerDbEnum.MainSqlServer,
            false);
    ddlServer.DataSource = ds.Tables[0];
    ddlServer.DataTextField = ds.Tables[0].Columns[1].ColumnName;
    ddlServer.DataValueField = ds.Tables[0].Columns[0].ColumnName;
    ddlServer.DataBind();
    ddlOrg.DataSource = ds.Tables[1];
    ddlOrg.DataTextField = ds.Tables[1].Columns[1].ColumnName;
    ddlOrg.DataValueField = ds.Tables[1].Columns[0].ColumnName;
    ddlOrg.DataBind();
    ddlTer.DataSource = ds.Tables[2];
    ddlTer.DataTextField = ds.Tables[2].Columns[1].ColumnName;
    ddlTer.DataValueField = ds.Tables[2].Columns[0].ColumnName;
    ddlTer.DataBind();
    ddlDest.DataSource = ds.Tables[3];
    ddlDest.DataTextField = ds.Tables[3].Columns[1].ColumnName;
    ddlDest.DataValueField = ds.Tables[3].Columns[0].ColumnName;
    ddlDest.DataBind();
    functionclass.SetFocus(ddlServer);
}

This is result of my code

任何人都可以告诉我这是什么问题,我该如何解决这个问题。

0 个答案:

没有答案