更新面板中的Ajax网格视图选择不起作用

时间:2013-06-18 13:04:26

标签: c#

我在更新面板中使用网格视图。我已将“自动生成选择按钮”属性设置为“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>

1 个答案:

答案 0 :(得分:0)

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