c# - 更新面板中的 Ajax GridView 选择不起作用

标签 c#

我在更新面板中使用 GridView 。我已将“自动生成选择按钮”属性设置为“true”,但是当我运行我的网站时,选择按钮不起作用。解决此问题的任何帮助将不胜感激。

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
<div style="overflow: scroll; width: 100%; height: 350px">
<ajaxToolkit:UpdatePanel ID="updatepanel1" runat="server">
<ContentTemplate>
<asp:GridView id="GridView1" runat="server" Width="754px" OnRowDataBound="GridView1_RowDataBound"       DataKeyNames="UniqueID" GridLines="None" ForeColor="#333333" EmptyDataText="There are no data records to display." DataSourceID="sdsMapsAdd" CellPadding="4" AutoGenerateColumns="False" AllowSorting="True" AllowPaging="False" OnRowCommand="GridView1_RowCommand" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <Columns>
    <asp:CommandField ShowSelectButton="True" />
    <asp:BoundField DataField="UniqueID" HeaderText="ID" ReadOnly="True"
    SortExpression="UniqueID" Visible="false"   />
    <asp:BoundField DataField="SiteName" HeaderText="Name" ReadOnly="True"
    SortExpression="SiteName" />
    <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />


    </Columns>
    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
    <EditRowStyle BackColor="#999999" />
    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"  />
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />


</asp:GridView>

</ContentTemplate>
</ajaxToolkit:UpdatePanel>
</div>
<asp:SqlDataSource ID="sdsAdd" runat="server" ConnectionString="<%$ ConnectionStrings:AddConnectionStrings %>"
SelectCommand="SELECT ID,Name,Address FROM [Data]where Status=1 order by Name" 
>
</asp:SqlDataSource>
</asp:Content>

最佳答案

UpdatePanel 是一个嵌入式 ASP.NET 控件(不是来自 AjaxControlToolkit 项目)。将 UpdatePanel 的前缀从 ajaxToolkit 更改为 asp

关于c# - 更新面板中的 Ajax GridView 选择不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17169612/

相关文章:

c# - 在 C# 中实现本地运行时不变性

c# - 将接口(interface)实现限制为结构?

c# - 如何在 Aero/.NET 4 中获取 block 样式进度条

c# - 安装 visual studio 2015 后 Microsoft Visual Studio 2012 已停止工作

c# - 事件和委托(delegate)与调用方法

c# - 如何使用 C# 将多个文本文件合并为一个文本文件?

c# - Lambda 表达式类型推断在继承链中是不同的。为什么?

c# - 如何将 Lazy<> 与 AutoMock (Moq) 一起使用

c# - 使用不可变栈

c# - 增加 Silverlight DataGrid 中的列宽以填充整个 DG 宽度