0

我有一个 GridView 显示用户提交并存储在数据库中的建议。在最后一列中,将显示状态。我想让此列成为可点击的,当管理员单击它时,将使用显示状态的 RadioButtonList 查看 ModalPopUp 窗口(Ajax ModalPopUpExtender)。我刚开始编写代码,遇到了很多问题。我修复了所有这些,除了以下一个:

未知的服务器标签“AjaxToolKit:ModalPopUpExtender”

我不知道如何修复错误。你能帮我吗?

我的 ASP.NET 代码:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
    <asp:TabContainer CssClass="tabCont" ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="500px" ScrollBars="Auto" Width="100%">
        <asp:TabPanel ID="All_SafetySuggestions_Tab" HeaderText="All" runat="server">
        <ContentTemplate>
            <div>
    <strong> Division </strong>
    <asp:DropDownList ID="ddlDivision" runat="server" AppendDataBoundItems="True" 
        AutoPostBack="True" DataSourceID="sqlDataSourceDivision" DataTextField="DivisionShortcut" 
        DataValueField="DivisionShortcut"  
        Width="175px" EnableViewState="False">
        <asp:ListItem Value="%">All</asp:ListItem>
    </asp:DropDownList>


    <br />  <br />  

        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
                        width="900px" CssClass="mGrid" 
                        DataSourceID="SqlDataSource1" 
                        OnRowDataBound="GridView1_RowDataBound">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" CssClass="alt" />
            <HeaderStyle Font-Bold = "True" ForeColor="Black" Height="20px"/> 
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ID" />
                <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                <asp:BoundField DataField="Description" HeaderText="Description" 
                    SortExpression="Description" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="Username" HeaderText="Username" 
                    SortExpression="Username" />
                <asp:BoundField DataField="DivisionShortcut" HeaderText="DivisionShortcut" 
                    SortExpression="DivisionShortcut" />
                <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />

                <%-- This to make status be opened and edited through the Ajax ModalPopUp Window --%>
                <asp:TemplateField HeaderText="Status">
                    <ItemTemplate>
                        <asp:LinkButton runat="server" ID="lnkSuggestionStatus" Text='<%#Eval("Status")%>'
                                        OnClick="lnkSuggestionTitle_Click">
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>

                <%--<asp:HyperLinkField HeaderText="Status" 
                    SortExpression="Status" />--%>
            </Columns>
            <RowStyle HorizontalAlign="Center" />
        </asp:GridView>

        <asp:Button runat="server" ID="btnModalPopUp" style="display:none" />

        <AjaxToolkit:ModalPopUpExtender ID="modalPopUpExtender1"
                                        runat="server" 
                                        TargetControlID="btnModalPopUp" 
                                        PopupControlID="pnlPopUp" 
                                        BackgroundCssClass="popUpStyle"
                                        PopupDragHandleControlID="panelDragHandle" 
                                        OkControlID="OKButton">
        </AjaxToolkit:ModalPopUpExtender>

        <asp:Panel runat="server" ID="pnlPopUp">
            <table id="suggestionStatus">
                <tr>
                    <asp:RadioButtonList ID="StatusList" runat="server">
                        <asp:ListItem>Received</asp:ListItem>
                        <asp:ListItem>Pending</asp:ListItem>
                        <asp:ListItem>Actioned</asp:ListItem>
                        <asp:ListItem>Transferred</asp:ListItem>
                    </asp:RadioButtonList>
                </tr>
                <tr>
                    <asp:Button ID="confirmButton" runat="server" Text="Confirm" 
                                OnClientClick="javascript:return confirm('Are you sure you want to send an email notification about the safety suggestion to the owner?')" 
                                OnClick="btnSendStatus_Click" />
                </tr>
            </table>
            <asp:Button ID="OKButton" runat="server" Text="Close" />
        </asp:Panel>

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:testConnectionString %>" 
            SelectCommand="SELECT     dbo.SafetySuggestionsLog.ID, dbo.SafetySuggestionsLog.Title, dbo.SafetySuggestionsLog.Description, dbo.employee.Name, dbo.SafetySuggestionsLog.Username, 
                      dbo.Divisions.DivisionShortcut, dbo.SafetySuggestionsType.Type, dbo.SafetySuggestionsStatus.Status
FROM         dbo.employee INNER JOIN
                      dbo.SafetySuggestionsLog ON dbo.employee.Username = dbo.SafetySuggestionsLog.Username INNER JOIN
                      dbo.Divisions ON dbo.employee.DivisionCode = dbo.Divisions.SapCode INNER JOIN
                      dbo.SafetySuggestionsType ON dbo.SafetySuggestionsLog.TypeID = dbo.SafetySuggestionsType.ID INNER JOIN
                      dbo.SafetySuggestionsStatus ON dbo.SafetySuggestionsLog.StatusID = dbo.SafetySuggestionsStatus.ID"
                      FilterExpression="[DivisionShortcut] like '{0}%'">

                      <FilterParameters>
                        <asp:ControlParameter ControlID="ddlDivision" Name="DivisionShortcut" 
                                                 PropertyName="SelectedValue" Type="String" />
                    </FilterParameters>
        </asp:SqlDataSource>

        <asp:SqlDataSource ID="sqlDataSourceDivision" runat="server" 
        ConnectionString="<%$ ConnectionStrings:testConnectionString %>" 
        SelectCommand="SELECT [DivisionShortcut] FROM [Divisions]"></asp:SqlDataSource>

       </div>
       </ContentTemplate>
   </asp:TabPanel>

我的 C# 代码隐藏:

protected void lnkSuggestionStatus_Click(object sender, EventArgs e)
    {


        modalPopUpExtender1.Show();
    }

此外,关于将在 ModalPopUp 窗口中显示的 RadioButtonList 值,如何将其绑定到数据库?

供您参考,数据库设计如下:

Employee Table: Username, Name
SafetySuggestionsLog Table: ID, Title, Description, Username, StatusID
SafetySuggestionsStatus Table: ID, Status
4

1 回答 1

0

好的,你做错了什么:

您正在通过其程序集名称调用 AJAXControl。你应该使用:

    <asp:ModalPopUpExtender />
instead of
    <AjaxToolkit:ModalPopUpExtender />

这可能会使模态弹出窗口工作!

于 2012-06-26T06:35:02.687 回答