0 Replies - 282 Views - Last Post: 17 August 2010 - 08:46 PM Rate Topic: -----

#1 Vomster  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 198
  • Joined: 15-May 08

DetailView insert problem

Posted 17 August 2010 - 08:46 PM

I've been following the example in the link below. More specifically, this one [VB Master-Details Insert (Separate Pages)]. I can get the insert page to come up but can't get it to actually insert the record. I tested the stored procedure out and it works fine when I run it manually. This code is from the insert page I have. If any other code is required, just say. If someone can point me in the right direction or give me something to test, I'd appreciate it.



http://quickstarts.a...etailsview.aspx

  protected void DetailsView1_ItemInserted(Object sender, System.Web.UI.WebControls.DetailsViewInsertedEventArgs e)
  {
      Response.Redirect("tmsinsert.aspx");
  }

  protected void DetailsView1_ModeChanging(Object sender, System.Web.UI.WebControls.DetailsViewModeEventArgs e)
  {
    if (e.CancelingEdit == true)
    {
      Response.Redirect("tmsmaint.aspx");
    }
  }



<asp:DetailsView DefaultMode="Insert" AutoGenerateRows="False" DataKeyNames="pr_id"
                DataSourceID="SqlDataSource3" HeaderText="Add" ID="DetailsView1" runat="server"
                Width="275px" OnItemInserted="DetailsView1_ItemInserted" OnModeChanging="DetailsView1_ModeChanging">
                <Fields>
                    <asp:BoundField DataField="pt_name" HeaderText="pt_name" SortExpression="pt_name" />
                    <asp:CommandField ShowInsertButton="true" />
                </Fields>
            </asp:DetailsView>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
                SelectCommand="GetPT" SelectCommandType="StoredProcedure"
                InsertCommand="InsertPT" InsertCommandType="StoredProcedure">
                <SelectParameters>
                    <asp:SessionParameter DefaultValue="" Name="pr_id" SessionField="pr_id" Type="Int32" />
                </SelectParameters>
                <InsertParameters>
                    <asp:SessionParameter DefaultValue="" Name="pr_id" SessionField="pr_id" Type="Int32" />
                    <asp:Parameter Name="pt_name" Type="String" />
                </InsertParameters>
            </asp:SqlDataSource>



Is This A Good Question/Topic? 0
  • +

Page 1 of 1