我有一个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();
}
此外,关于将要显示的RadioButtonList值,在ModalPopUp窗口中,如何将其绑定到数据库?
有关您的信息,数据库设计如下:
Employee Table: Username, Name
SafetySuggestionsLog Table: ID, Title, Description, Username, StatusID
SafetySuggestionsStatus Table: ID, Status
答案 0 :(得分:0)
好的,你做错了什么:
您通过其程序集名称调用AJAX控件。你应该使用:
<asp:ModalPopUpExtender />
instead of
<AjaxToolkit:ModalPopUpExtender />
这可能会使Modal Popup工作!