C
Clodoaldo
The insert command in the sqlDataSource is ignored. The OnInserted
event is executed.
As the command was ignored i issued a wrong insert command ("x") just
to see if it would throw an execption but it didn't.
<asp:FormView ID="FV_trecho" runat="server"
DataSourceID="SqlDS_FV_trecho" >
<InsertItemTemplate>
....
<asp:LinkButton ID="LinkButton_Inserir" runat="server" Text="Inserir"
CommandName="Insert" ></asp:LinkButton>
....
</InsertItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDS_FV_trecho" runat="server"
ConnectionString="<%$ ConnectionStrings:Savi_desenConnectionString %>"
InsertCommandType="Text"
InsertCommand="x"
OnInserted="SqlDS_FV_trechnItemInserted"
....
</InsertParameters>
It executes the OnInserted event redirecting to another page:
protected void SqlDS_FV_trechnItemInserted(object sender,
SqlDataSourceStatusEventArgs e)
{
string viagem_id =
e.Command.Parameters["@viagem_id"].Value.ToString();
Response.Redirect("~/trechos.aspx?viagem_id=" + viagem_id);
}
Any ideas?
Regards, Clodoaldo Pinto Neto
event is executed.
As the command was ignored i issued a wrong insert command ("x") just
to see if it would throw an execption but it didn't.
<asp:FormView ID="FV_trecho" runat="server"
DataSourceID="SqlDS_FV_trecho" >
<InsertItemTemplate>
....
<asp:LinkButton ID="LinkButton_Inserir" runat="server" Text="Inserir"
CommandName="Insert" ></asp:LinkButton>
....
</InsertItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDS_FV_trecho" runat="server"
ConnectionString="<%$ ConnectionStrings:Savi_desenConnectionString %>"
InsertCommandType="Text"
InsertCommand="x"
OnInserted="SqlDS_FV_trechnItemInserted"
<InsertParameters>
....
</InsertParameters>
It executes the OnInserted event redirecting to another page:
protected void SqlDS_FV_trechnItemInserted(object sender,
SqlDataSourceStatusEventArgs e)
{
string viagem_id =
e.Command.Parameters["@viagem_id"].Value.ToString();
Response.Redirect("~/trechos.aspx?viagem_id=" + viagem_id);
}
Any ideas?
Regards, Clodoaldo Pinto Neto