简体   繁体   中英

Ajax grid view in update panel select not working

I am using a grid view in update panel. I have set the "autogenerate select button" property to "true", but when I run my web site, the select button is not working. Any help in solving this problem would be appreciated.

<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 is an embedded ASP.NET control (not from AjaxControlToolkit project). Change prefix from ajaxToolkit to asp for UpdatePanel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM