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> <asparameter Name="dcca_applicantid" Type="String" /> <asparameter Name="dcca_firstname" Type="String" /> </SelectParameters> <UpdateParameters> <asparameter Name="dcca_applicantid" Type="String" /> <asparameter Name="dcca_firstname" Type="String" /> </UpdateParameters> <InsertParameters> <asparameter 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>
|