Trouble with EditItemTemplate mode

Posted By saturation Wed 23 Mar 2011
Rated stars based on 1 vote.
Add to Favorites0
Author Message
saturation
 Posted Sat 26 Mar 2011
Supreme Being

Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)

Group: Forum Members
Last Active: Fri 30 Nov 2012
Posts: 108, Visits: 1,185
Wow, thank you guys.   I broke it down even further after your suggestions Mohammad and Paul....Turns out I didn't have the "[" and "]" around my SQL fields.   Now I feel like a fool!
Mohammad
 Posted Fri 25 Mar 2011
Kartris Expert

Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)

Group: Administrators
Last Active: Sun 27 Sep 2015
Posts: 115, Visits: 706
In the FormView control, if the select statement returns 0 records the whole EditItemTemplate will not be rendered in the page, also if you don't have at least 1 input control in the EditItemTemplate the same story will happen; the template will not be rendered.

In your second post :
<EditItemTemplate>            
    Some Test TEXT!!!
    <h3>Applicant Info:</h3>
</EditItemTemplate>

will never rendered in the page, cause it doesn't have any input control (text box, dropdown ..etc)

The InsertItemTemplate will not be rendered also if you don't have at least 1 input control.

So, all what I could think about is to make sure the select command will return at least 1 record and make sure to have at least 1 input control in the Insert/Edit ItemTemplate(s) - just like the 1st post.
Fri 25 Mar 2011 by Mohammad
saturation
 Posted Fri 25 Mar 2011
Supreme Being

Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)

Group: Forum Members
Last Active: Fri 30 Nov 2012
Posts: 108, Visits: 1,185
I did View > Source and searched for "Some Test" and it doesn't seem to be even putting the text in the page.  What I cannot figure out is why the InsertItemTemplate will render the controls while the EditItemTemplate does not?   It's like it doesn't even recognize the EditItemTemplate tags.
Paul
 Posted Fri 25 Mar 2011
große Käse

große Käse - (524,176 reputation)große Käse - (524,176 reputation)große Käse - (524,176 reputation)große Käse - (524,176 reputation)große Käse - (524,176 reputation)große Käse - (524,176 reputation)große Käse - (524,176 reputation)große Käse - (524,176 reputation)große Käse - (524,176 reputation)

Group: Administrators
Last Active: Tue 10 Sep 2024
Posts: 807, Visits: 2,748
When you view the source of the page, does the section show up there? I'm curious whether by 'not rendering' it is because the HTML itself is not generated, or because for some reason the browser is not displaying it.

--
If my post solves your issue, can you 'Mark as Answer' so it's easier for other users to find in future.

If you would like to be informed of new features, new releases, developments and occasional special bonuses, please sign up to our mailing list: http://bit.ly/19sKMZb
saturation
 Posted Wed 23 Mar 2011
Supreme Being

Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)

Group: Forum Members
Last Active: Fri 30 Nov 2012
Posts: 108, Visits: 1,185
Thanks, Mohammad--but even if I strip everything out but the EditItemTemplate and hard-code some text, it still does not render it.   Ideas?

<%@ page title="" language="VB" masterpagefile="~/MasterPages/Kartris.master" autoeventwireup="true" inherits="contact, KartrisCompiled" enableEventValidation="false" viewStateEncryptionMode="Always" %>

<asp:Content ID="cntMain" ContentPlaceHolderID="cntMain" runat="Server">

    <div id="contact">
        <div class="breadcrumbtrail">
            <asp:SiteMapPath ID="smpTrail2" PathSeparator="<% $Resources: Kartris, ContentText_BreadcrumbSeparator %>"
                runat="server" SiteMapProvider="BreadCrumbSiteMap" />
        </div>
        <h1>
        <asp:Literal ID="litPageTitleContactUs" runat="server" Text="<%$ Resources: Kartris, PageTitle_LoanApplication %>" />
        </h1>
        <asp:label id="HelloWorld" runat="server" />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                ConnectionString="<%$ ConnectionStrings:KartrisSQLConnection %>" 
                >
            </asp:SqlDataSource>

        <asp:FormView ID="FormView1" runat="server" DataSourceId="SqlDataSource1" DataKeyNames="dcca_applicantid" EmptyDataText="NO DATA" DefaultMode="Edit" EnableViewState="true" >
             <EditItemTemplate>

            Some Test TEXT!!!
            <h3>Applicant Info:</h3>

            </EditItemTemplate>
        </asp:FormView>
    </div>
</asp:Content>
Wed 23 Mar 2011 by saturation
Mohammad
 Posted Wed 23 Mar 2011
Kartris Expert

Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)Kartris Expert - (80,921 reputation)

Group: Administrators
Last Active: Sun 27 Sep 2015
Posts: 115, Visits: 706
Nothing in the compiled code prevents something like this.

Try changing the "
AutoEventWireup" attribute in the page directive to true instead of false.
saturation
 Posted Wed 23 Mar 2011
Supreme Being

Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)Supreme Being - (66,832 reputation)

Group: Forum Members
Last Active: Fri 30 Nov 2012
Posts: 108, Visits: 1,185
I have a form/.NET page that is able to makes inserts into the database, but for some reason, if I set the default form view to edit mode and hard-code an ID in my SelectCommand, the form does not show at all (even though the query returns records in SQL).  If I set DefaultMode back to Insert, it shows again.   Is there something in the compiled code that prevents this form from being shown in edit mode?   My code is below:

<%@ page title="" language="VB" masterpagefile="~/MasterPages/Kartris.master" autoeventwireup="false" inherits="contact, KartrisCompiled" enableEventValidation="false" viewStateEncryptionMode="Always" %>

<asp:Content ID="cntMain" ContentPlaceHolderID="cntMain" runat="Server">

    <div id="contact">
        <div class="breadcrumbtrail">
            <asp:SiteMapPath ID="smpTrail2" PathSeparator="<% $Resources: Kartris, ContentText_BreadcrumbSeparator %>" runat="server" SiteMapProvider="BreadCrumbSiteMap" />
        </div>
        <h1>
            <asp:Literal ID="litPageTitleContactUs" runat="server" Text="<%$ Resources: Kartris, PageTitle_LoanApplication %>" />
        </h1>
       
            <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                ConnectionString="<%$ ConnectionStrings:KartrisSQLConnection %>" 
                SelectCommand="SELECT dcca_applicantid,dcca_firstname FROM tblDCCreditApplication WHERE dcca_applicantid=1"
                UpdateCommand="UPDATE tblDCCreditApplication SET dcca_firstname=@dcca_firstname"
                InsertCommand="EXEC spDCUsers_AddUserAddressCreditApp @dcca_firstname">
  <SelectParameters>
      <aspTonguearameter Name="dcca_applicantid" Type="String" />
      <aspTonguearameter Name="dcca_firstname" Type="String" />
  </SelectParameters>               
  <UpdateParameters>
      <aspTonguearameter Name="dcca_applicantid" Type="String" />
      <aspTonguearameter Name="dcca_firstname" Type="String" />
  </UpdateParameters>
  <InsertParameters>
      <aspTonguearameter Name="dcca_firstname" Type="String" />
  </InsertParameters>
     </asp:SqlDataSource>

        <asp:FormView ID="FormView1" runat="server" DataSourceId="SqlDataSource1" DataKeyNames="dcca_applicantid" DefaultMode="Edit" >
            <InsertItemTemplate>
                <h3>Applicant Info:</h3>
                <span class="Kartris-DetailsView-Name">First Name:</span><span class="Kartris-DetailsView-Value"><asp:TextBox ID="dcca_firstname" runat="server" Text='<%# Bind("dcca_firstname") %>'></asp:TextBox></span><br />
                <div class="submitbuttons">
                    <asp:Button CssClass="button" ID="butSubmit" runat="server" CommandName="Insert" Text="<%$ Resources: Kartris, FormButton_Submit %>" />
                </div>
            </InsertItemTemplate>

            <EditItemTemplate>
                <h3>Applicant Info:</h3>
                <span class="Kartris-DetailsView-Name">First Name:</span><span class="Kartris-DetailsView-Value"><asp:TextBox ID="dcca_firstname" runat="server" Text='<%# Bind("dcca_firstname") %>'></asp:TextBox></span><br />
                <div class="submitbuttons">
                    <asp:Button CssClass="button" ID="butSubmit" runat="server" CommandName="Edit" Text="<%$ Resources: Kartris, FormButton_Submit %>" />
                </div>
            </EditItemTemplate>
        </asp:FormView>
    </div>
</asp:Content>

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top