フォームビューで挿入コマンドが成功した後にリダイレクトしようとしています。ここに私が持っているものがあります:
詳細.aspx:
<asp:FormView id="formview1"...datasourceid="detailsSQLDS">
<InsertItemTemplate>
DateOfService:
<asp:TextBox ID="DateOfServiceTextBox" runat="server"
Text='<%# Bind("DateOfService") %>' />
<br />
InsurancePrimary:
<asp:TextBox ID="InsurancePrimaryTextBox" runat="server"
Text='<%# Bind("InsurancePrimary") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
</InsertItemTemplate>
</asp:FOrmView>
....
<asp:SqlDataSource ID="detailsSQLDS" runat="server"
ConnectionString="..."
InsertCommandType="StoredProcedure"
InsertCommand="usp_Insert"
>
コードビハインド:
protected void formview1_ItemInserted(object sender, FormViewInsertedEventArgs e)
{
Response.Redirect( "List.aspx?mrn=" + Request.QueryString["mrn"] );
}
挿入は正常に機能しますが、リダイレクトは機能しません。関数 formview1_ItemInserted(....) を起動しているとは思いません。挿入が成功した後にこの関数を起動するようにフォームビューに指示する方法、またはこれを行う他の方法はありますか? ありがとう!