[ADO.NET] Equivalent de ObjectDataSourceMethodEventArgs avec SqlDataSource
Salut,
Je suis en train d'appliquer cet excellent tutorial pour ajouter une ligne d'insertion dans le footer d'une GridView, et je touche au but!
Dernier petit problème. J'ai du mal à adapter une petite option à mon propre code.
Voilà l'original :
Code:
1 2 3 4 5 6 7 8 9 10
| protected void odsIngredient_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
{
string Ingredient = ((TextBox)gvIngredient.FooterRow.FindControl("tbIngredient")).Text;
string stock = ((TextBox)gvIngredient.FooterRow.FindControl("tbStock")).Text;
string minstock = ((TextBox)gvIngredient.FooterRow.FindControl("tbMinStock")).Text;
e.InputParameters["ProductIngredient_Name"] = Ingredient;
e.InputParameters["ProductIngredient_Stock"] = stock;
e.InputParameters["ProductIngredient_MinStock"] = minstock;
} |
Voilà ma version :
Code:
1 2 3 4 5 6 7 8 9 10
| protected void SqlDataSourceProspects_Inserting(object sender, SqlDataSourceFilteringEventArgs e)
{
e.ParameterValues["NomProspect"] = ((TextBox)GridView1.FooterRow.FindControl("TextBoxNomInsert")).Text;
e.ParameterValues["PrenomProspect"] = ((TextBox)GridView1.FooterRow.FindControl("TextBoxPrenomInsert")).Text;
e.ParameterValues["AdresseProspect"] = ((TextBox)GridView1.FooterRow.FindControl("TextBoxAdresseInsert")).Text;
e.ParameterValues["CPProspect"] = ((TextBox)GridView1.FooterRow.FindControl("TextBoxCPInsert")).Text;
e.ParameterValues["VilleProspect"] = ((TextBox)GridView1.FooterRow.FindControl("TextBoxVilleInsert")).Text;
e.ParameterValues["TelProspect"] = ((TextBox)GridView1.FooterRow.FindControl("TextBoxTelInsert")).Text;
e.ParameterValues["EmailProspect"] = ((TextBox)GridView1.FooterRow.FindControl("TextBoxEmailInsert")).Text;
} |
Et j'ai droit à l'erreur suivante :
"Erreur 1 Aucune surcharge pour 'SqlDataSourceProspects_Inserting' ne correspond au délégué 'System.Web.UI.WebControls.SqlDataSourceCommandEventHandler'".
En fait je ne sois pas quoi mettre à la place de "ObjectDataSourceMethodEventArgs" étant donné que ma source est un SqlDataSource et non un ObjectDataSource.
Merci à ceux qui sauront m'éclairer...