带有TemplateField the ExtenderSlider的ASP DetailsView仅在回发后启用

时间:2018-08-21 09:54:34

标签: asp.net ajaxcontroltoolkit detailsview sliderextender

我在DetailsView的TemplateField中使用AjaxControlKit:ExtenderSlider。单击Insert-CommandButton时,滑块的手柄不可移动。回发后将其启用。

该怎么办,使Slider可一次移动?绑定的TextBox的AutoPostBack为True,而Slider的Enabled Attribute为True。

<asp:UpdatePanel runat="server">
        <ContentTemplate>

            <asp:Label Text="" runat="server" ID="labelAnzahlGrid" style="float:left;font-size:1.2em;font-weight:bold;color:darkgreen;"/>&nbsp;<asp:Label Text=" Datensätze in der Übersicht" runat="server" />

            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="userid" DataSourceID="SqlDataSource2" AllowSorting="True" AllowPaging="True" GridLines="None" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt">
                <AlternatingRowStyle BackColor="LightGray" />
                <Columns>
                    <asp:BoundField DataField="vorname" HeaderText="vorname" SortExpression="vorname"></asp:BoundField>
                    <asp:BoundField DataField="nachname" HeaderText="nachname" SortExpression="nachname"></asp:BoundField>       
                    <asp:BoundField DataField="email" HeaderText="email" SortExpression="email"></asp:BoundField>
                    <asp:BoundField DataField="level" HeaderText="level" SortExpression="level"></asp:BoundField>
                    <asp:CheckBoxField DataField="bestaetigt" HeaderText="bestaetigt" SortExpression="bestaetigt" />
                    <asp:CommandField ShowSelectButton="true" ShowCancelButton="true" ShowDeleteButton="true" ShowEditButton="true"/>
                </Columns>
            </asp:GridView>

            <br />

            <asp:DetailsView ID="DetailsView2" runat="server" DataSourceID="SqlDataSource1" AutoGenerateRows="False" DataKeyNames="userid" CellSpacing="20" Font-Size="1.2em" CssClass="dtl" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="20" ForeColor="Black" GridLines="Vertical" Width="100%"  OnItemDeleted="DetailsView2_ItemDeleted" OnItemCreated="DetailsView2_ItemCreated" OnItemUpdated="DetailsView2_ItemUpdated" OnItemInserting="DetailsView2_ItemInserting">
                <EmptyDataTemplate>
                    <asp:Label Text="Zur Zeit kein Benutzer ausgewählt.<br />Bitte wählen Sie oben in der Übersicht mit der Lupe einen Verein für die Detail-Ansicht aus.<br />Oder legen Sie mit dem grünen Button (+) einen neuen Verein an." runat="server" Style="padding: 50px; font-size: 1.2em; font-weight: bold" />
                </EmptyDataTemplate>
                <AlternatingRowStyle BackColor="LightGray"></AlternatingRowStyle>
                <EditRowStyle Font-Bold="True" ForeColor="Black"></EditRowStyle>
                <Fields>
                    <asp:BoundField DataField="userid" HeaderText="ID: " ReadOnly="True" InsertVisible="False" SortExpression="userid"></asp:BoundField>
                    <asp:BoundField DataField="vorname" HeaderText="Vorname: " SortExpression="vorname" ItemStyle-CssClass="bound100Prozent abstandRechts20"></asp:BoundField>
                    <asp:BoundField DataField="nachname" HeaderText="Nachname: " SortExpression="nachname" ItemStyle-CssClass="bound100Prozent abstandRechts20"></asp:BoundField>

                    <asp:TemplateField HeaderText="E-Mail: ">
                        <ItemTemplate>
                            <asp:Label Text='<%# Eval("email") %>' runat="server" />
                        </ItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox runat="server" ID="textBoxEmail" Text='<%# Bind("email") %>'/>
                            <asp:RequiredFieldValidator ErrorMessage="ACHTUNG: keine E-Mail-Adresse" ControlToValidate="textBoxEmail" runat="server" ID="rfvEmail" ValidationGroup="vgSubmit" ForeColor="Red"/>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Gültige E-Mail erforderlich" ValidationGroup="vgSubmit" ControlToValidate="textBoxEmail" ForeColor="Red" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                        </InsertItemTemplate>                           
                        <EditItemTemplate>
                            <asp:TextBox runat="server" ID="textBoxEmail" Text='<%# Bind("email") %>'/>
                            <asp:RequiredFieldValidator ErrorMessage="ACHTUNG: keine E-Mail-Adresse" ControlToValidate="textBoxEmail" runat="server" ID="rfvEmail" ValidationGroup="vgSubmit" ForeColor="Red"/>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Gültige E-Mail erforderlich" ValidationGroup="vgSubmit" ControlToValidate="textBoxEmail" ForeColor="Red" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>             
                        </EditItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Berechtigung: ">
                        <ItemTemplate>
                            <asp:Label Text='<%# Eval("level") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="sliderTextbox" runat="server" AutoPostBack="true" Text='<%# Bind("level") %>'></asp:TextBox>
                            <asp:SliderExtender ID="SliderExtender1" TargetControlID="sliderTextbox" BoundControlID="label1" Minimum="0" Maximum="9" RailCssClass="railWidth100" HandleCssClass="handle2" EnableHandleAnimation="true" Steps="9" runat="server"></asp:SliderExtender>
                            <asp:Label ID="label1" runat="server" style="float:right;margin-right:45%;" Font-Size="Large"/>       
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox ID="sliderTextbox" runat="server" AutoPostBack="true" Text='<%# Bind("level") %>'></asp:TextBox>
                            <asp:SliderExtender ID="SliderExtender1" TargetControlID="sliderTextbox" Enabled="true" BoundControlID="label1" Minimum="0" Maximum="9" RailCssClass="railWidth100" HandleCssClass="handle2" EnableHandleAnimation="true" Steps="9" runat="server"></asp:SliderExtender>
                            <asp:Label ID="label1" runat="server" style="float:right;margin-right:45%;" Font-Size="Large"/>
                        </InsertItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Passwort: ">
                        <ItemTemplate>
                            <asp:Label Text='<%# Eval("passwort") %>' runat="server" />
                        </ItemTemplate>
                        <InsertItemTemplate>
                            <asp:TextBox runat="server" ID="textboxPasswort" Text='<%# Bind("passwort") %>'/>
                            <asp:RequiredFieldValidator ErrorMessage="ACHTUNG: kein Passwort" ControlToValidate="textboxPasswort" runat="server" ID="rfvPasswort" ValidationGroup="vgSubmit" ForeColor="Red"/>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Mindestens 8 Zeichen, jeweils ein Klein-, Grossbuchstabe, Ziffer und Sonderzeichen" ValidationGroup="vgSubmit" ControlToValidate="textboxPasswort" ForeColor="Red" ValidationExpression="(^[a-z0-9]{40}$)|(^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z0-9])[A-Za-z\d\W_]{8,}$)"></asp:RegularExpressionValidator>
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox runat="server" ID="textboxPasswort" Text='<%# Bind("passwort") %>'/>
                             <asp:RequiredFieldValidator ErrorMessage="ACHTUNG: kein Passwort" ControlToValidate="textboxPasswort" runat="server" ID="rfvPasswort" ValidationGroup="vgSubmit" ForeColor="Red"/>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Mindestens 8 Zeichen, jeweils ein Klein-, Grossbuchstabe, Ziffer und Sonderzeichen" ValidationGroup="vgSubmit" ControlToValidate="textboxPasswort" ForeColor="Red" ValidationExpression="(^[a-z0-9]{40}$)|(^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z0-9])[A-Za-z\d\W_]{8,}$)"></asp:RegularExpressionValidator>
                        </InsertItemTemplate>
                        </EditItemTemplate>
                    </asp:TemplateField>


                    <asp:CheckBoxField DataField="bestaetigt" HeaderText="Bestätigt: " SortExpression="bestaetigt" ItemStyle-CssClass="bigcheck"></asp:CheckBoxField>

                    <asp:CommandField ShowCancelButton="true" ShowEditButton="true" ShowDeleteButton="true" ShowInsertButton="true" ValidationGroup="vgSubmit"/>
                </Fields>
                <FooterStyle BackColor="#CCCCCC" Font-Size="20" Font-Bold="true"></FooterStyle>
                <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White"></HeaderStyle>
                <FieldHeaderStyle HorizontalAlign="Right" CssClass="abstandRechts20" Font-Bold="true" Width="20%"/>
                <PagerStyle HorizontalAlign="Center" BackColor="#999999" ForeColor="Black"></PagerStyle>
                <CommandRowStyle Font-Size="1.2em" ForeColor="White" Height="50" HorizontalAlign="Center"/>
                <RowStyle width="100%" CssClass="reihePadding5"/>
            </asp:DetailsView>

        </ContentTemplate>
    </asp:UpdatePanel>

0 个答案:

没有答案