none
DetailView / ItemTemplate

    Question

  • Bonjour

    Pourquoi le detailview suivant ne fonctionnne t'il pas?

    Erreur : Erreur 7 System.Web.UI.WebControls.DataControlFieldCollection doit avoir des éléments de type 'System.Web.UI.WebControls.DataControlField'. 'InsertItemTemplate' est de type 'System.Web.UI.HtmlControls.HtmlGenericControl'....

    <asp:DetailsView ID="dv" runat="server" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2"  DataKeyNames="idPlanningParametre"
            ForeColor="Black" Height="50px" Width="80%" Visible="False" DataSourceID="ObjDetail" AutoGenerateRows="False" >
            <EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
            <Fields>
                <asp:TemplateField HeaderText="idParametre" Visible="False">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# GetNomParametre(Eval("idParametre"))%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Valeur Min.">
                    <EditItemTemplate>
                        <asp:TextBox ID="TBValeurNum1" runat="server" Text='<%# Bind("ValeurNum1")%>' Visible='<%# EstTypeNumerique(Eval("idParametre"))%>'></asp:TextBox>
                        <asp:TextBox ID="TBValeurString1" runat="server" Text='<%# Bind("ValeurString1") %>' Visible='<%# EstTypeString(Eval("idParametre"))%>'></asp:TextBox>
                        <asp:TextBox ID="TBValeurDate1" runat="server" Text='<%# Bind("ValeurDate1")%>' Visible='<%# EstTypeDate(Eval("idParametre"))%>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TBValeurNum1" runat="server" Text='<%# Bind("ValeurNum1")%>' Visible='<%# EstTypeNumerique(Eval("idParametre"))%>'></asp:TextBox>
                        <asp:TextBox ID="TBValeurString1" runat="server" Text='<%# Bind("ValeurString1") %>' Visible='<%# EstTypeString(Eval("idParametre"))%>'></asp:TextBox>
                        <asp:TextBox ID="TBValeurDate1" runat="server" Text='<%# Bind("ValeurDate1")%>' Visible='<%# EstTypeDate(Eval("idParametre"))%>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:label ID="TBValeurNum1" runat="server" Text='<%# Bind("ValeurNum1")%>' Visible='<%# EstTypeNumerique(Eval("idParametre"))%>'></asp:label>
                        <asp:label ID="TBValeurString1" runat="server" Text='<%# Bind("ValeurString1") %>' Visible='<%# EstTypeString(Eval("idParametre"))%>'></asp:label>
                        <asp:label ID="TBValeurDate1" runat="server" Text='<%# Bind("ValeurDate1")%>' Visible='<%# EstTypeDate(Eval("idParametre"))%>'></asp:label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Valeur Max." Visible='<%# EstPlage(Eval("idParametre"))%>'>
                    <EditItemTemplate>
                        <asp:TextBox ID="TBValeurNum2" runat="server" Text='<%# Bind("ValeurNum2")%>' Visible='<%# EstTypeNumerique(Eval("idParametre"))%>'></asp:TextBox>
                        <asp:TextBox ID="TBValeurString2" runat="server" Text='<%# Bind("ValeurString2")%>' Visible='<%# EstTypeString(Eval("idParametre"))%>'></asp:TextBox>
                        <asp:TextBox ID="TBValeurDate2" runat="server" Text='<%# Bind("ValeurDate2")%>' Visible='<%# EstTypeDate(Eval("idParametre"))%>'></asp:TextBox>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:TextBox ID="TBValeurNum2" runat="server" Text='<%# Bind("ValeurNum2")%>' Visible='<%# EstTypeNumerique(Eval("idParametre"))%>'></asp:TextBox>
                        <asp:TextBox ID="TBValeurString2" runat="server" Text='<%# Bind("ValeurString2")%>' Visible='<%# EstTypeString(Eval("idParametre"))%>'></asp:TextBox>
                        <asp:TextBox ID="TBValeurDate2" runat="server" Text='<%# Bind("ValeurDate2")%>' Visible='<%# EstTypeDate(Eval("idParametre"))%>'></asp:TextBox>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:label ID="TBValeurNum2" runat="server" Text='<%# Bind("ValeurNum2")%>' Visible='<%# EstTypeNumerique(Eval("idParametre"))%>'></asp:label>
                        <asp:label ID="TBValeurString2" runat="server" Text='<%# Bind("ValeurString2")%>' Visible='<%# EstTypeString(Eval("idParametre"))%>'></asp:label>
                        <asp:label ID="TBValeurDate2" runat="server" Text='<%# Bind("ValeurDate2")%>' Visible='<%# EstTypeDate(Eval("idParametre"))%>'></asp:label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="idParametre" DataField="idParametre" SortExpression="idParametre" Visible="False"  />
                <asp:BoundField DataField="idPlanning" HeaderText="idPlanning" SortExpression="idPlanning" Visible="False" />
                <asp:BoundField DataField="idPlanningParametre" HeaderText="idPlanningParametre" SortExpression="idPlanningParametre" Visible="False" />
                <asp:CommandField ShowEditButton="True" />
            </Fields>
            <FooterStyle BackColor="#CCCCCC" />
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
            <RowStyle BackColor="White" />
        </asp:DetailsView>


    FB

    lundi 24 juin 2013 13:51

Toutes les réponses