Reputation: 512
I'm using FormView to add new data to the sql server. I try to change some of the data that the user inserting, like replace "a" with "A"
I try to use the following code:
protected void FormViewInsertEventHandler(object sender, SqlDataSourceCommandEventArgs e)
{
e.Values["Institution_fax"] = "33333";
}
and
<asp:SqlDataSource ID="SqlDataSourceSP" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
InsertCommand="usp_limodimInstitution_insert"
InsertCommandType="StoredProcedure"
SelectCommand="select * from tbl_limodim_Institution">
But i get the following error
No overload for 'FormViewInsertEventHandler' matches delegate 'System.Web.UI.WebControls.FormViewInsertEventHandler'
What have I missed?
Upvotes: 0
Views: 551
Reputation: 28970
You can try to change signature of your delegate to
public delegate void FormViewInsertEventHandler( Object sender, FormViewInsertEventArgs e )
{
......
}
Upvotes: 0
Reputation: 49988
Your argument to the event handler is incorrect
protected void FormViewInsertEventHandler(object sender, SqlDataSourceCommandEventArgs e)
should be:
protected void FormViewInsertEventHandler(object sender, FormViewInsertEventArgs e)
Upvotes: 1
Reputation: 8402
Your method signature is incorrect for the event handler, it should be:
protected void FormViewInsertEventHandler(object sender, FormViewInsertEventArgs e)
{
e.Values["Institution_fax"] = "33333";
}
You can't replace the FormViewInsertEventArgs with SqlDataSourceCommandEventArgs.
Upvotes: 1