GridView中的ItemTemplate内的按钮不起作用-UpdatePanel

时间:2018-08-03 21:18:24

标签: button gridview updatepanel itemtemplate

我有一个GridView。 在每行内部,都有一个不起作用的按钮。 首先,巴顿什么也没做,所以我认为他失去了所有背景知识。我认为是因为存在“ UpdatePanel”,但找不到错误。

这是我的代码:

<div id = "tabs-5" class="tab-pane fade well">  

        <asp:UpdatePanel ID="UpdatePanel1" updatemode="conditional" runat="server">
            <ContentTemplate>

                <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                    CancelSelectOnNullParameter="true"
                    ConnectionString="<%$ ConnectionStrings:dataConnection %>" 
                    SelectCommand="">
                    <SelectParameters>
                        <asp:SessionParameter Name="ls_id" SessionField="ls_id" Type="Int32" ConvertEmptyStringToNull="true" DefaultValue="0"/>
                    </SelectParameters>
                </asp:SqlDataSource>


                <asp:GridView ID="FlaechenGridView"
                    class="mydatagrid"
                    AutoGenerateColumns="false"
                    EmptyDataText="Bisher keine Flächen!"
                    AllowPaging="true"  
                    OnPageIndexChanging="FlaechenGridView_PageIndexChanging"
                    runat="server"
                    DataKeyNames="ls_id"
                    IsEnabled="true" PageSize="10">

                    <Columns>

                        <asp:TemplateField HeaderText="-" ItemStyle-Width="50px">
                            <ItemTemplate>
                                <asp:Button ID="btnFlaecheAnsehen" Text="OK" runat="server" Width="50px" CssClass="btn btn-mybtn" 
                                    CommandArgument='<%#Bind("space_id") %>' onCommand="btnFlaecheAnsehen_Click" >
                                </asp:Button>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="space_building_part" HeaderText="Bauteil"
                            InsertVisible="false" ReadOnly="true" Visible="true" SortExpression="space_building_part" />
                        <asp:BoundField DataField="space_bez" HeaderText="Bezeichnung"
                            InsertVisible="false" ReadOnly="true" Visible="true" SortExpression="space_bez" />
                        <asp:BoundField DataField="space_type_of_use" HeaderText="Nutzungsart"
                            InsertVisible="false" ReadOnly="true" Visible="true" SortExpression="space_type_of_use" />
                        <asp:BoundField DataField="space_status" HeaderText="Status"
                            InsertVisible="false" ReadOnly="true" Visible="true" SortExpression="space_status" />
                        <asp:BoundField DataField="space_size" HeaderText="Größe (m²)"
                            InsertVisible="false" ReadOnly="true" Visible="true" SortExpression="space_size" DataFormatString="{0:F2}" />
                        <asp:BoundField DataField="space_available_from" HeaderText="Verfügbar ab"
                            InsertVisible="false" ReadOnly="true" Visible="true" SortExpression="space_available_from" />
                        <asp:BoundField DataField="space_lease" HeaderText="Kaltmiete (mtl./m²)"
                            InsertVisible="false" ReadOnly="true" Visible="true" SortExpression="space_lease" DataFormatString="{0:C}" />                   
                        <asp:BoundField DataField="space_operating_costs" HeaderText="Betriebskosten (mtl./m²)"
                            InsertVisible="false" ReadOnly="true" Visible="true" SortExpression="space_operating_costs" DataFormatString="{0:C}" />                 
                    </Columns>
                    <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast" PageButtonCount="4" />
                    <PagerStyle CssClass="mypager" />
                    <HeaderStyle CssClass="myheader" />
                    <FooterStyle CssClass="myfooter" />
                    <RowStyle CssClass="myrows" />
                    <SelectedRowStyle CssClass="myselectedrow" />
                </asp:GridView>

            </ContentTemplate>
        </asp:UpdatePanel>

    </div>

也许您可以帮助我,发现我的错误?

0 个答案:

没有答案