Bonjour!
J'aimerais vous poser une question concernant le datagrid editable!
J'ai un datagrid à 2 colonnes,la 1ere est la liste des pays et l'autre est le prix du gasoil de chak pays,le format est en float et c cette colonne ki est en editable...J'aimerais faire l'update de ce datagrid...Je ne sais pas comment on pourrait récupérer les données d'un datagrid éditable..
voici mon code
C'est le bouton valider...
protectedvoid ValiderPrix_Btn_Click(object sender, EventArgs e)
{
try
{
FacturationCmd oFacturationCmd = newFacturationCmd();
oFacturationCmd.iAction = CommandConst.iCmdParametreUpdatePaysGasoil;
oFacturationCmd.sCodePays = oFacturationCmd.sCodePays;
oFacturationCmd.sAaaamm = AnneeEnCours_Label.Text;
//oFacturationCmd.fMontant = ;
oFacturationCmd.execute(IsolationLevel.ReadUncommitted);
loadPaysPrixDs();
}
catch (UtilException ex)
{
ErrorHandler.HandleError(ex, null);
showError(GetResourceError(ex.Code));
}
catch (Exception ex)
{
ErrorHandler.HandleError(ex, null);
showError(ex.Message);
}
}
c'est mon dataset....
#region updatePays
publicstaticDataSet updatePays(String sCodePays, float fMontant, String sAaaamm, TxHelper oTxHelper)
{
try
{
SqlParameter[] sqlParameters = newSqlParameter[3];
sqlParameters[0] = (SqlParameter)AddInParameter("CODE_PAYS", sCodePays);
sqlParameters[1] = (SqlParameter)AddInParameter("MONTANT", fMontant);
sqlParameters[2] = (SqlParameter)AddInParameter("AAAAMM", sAaaamm);
return ExecuteQueryDataSet(UPDATE_PAYS_GASOIL, sqlParameters, oTxHelper);
}
catch (SqlException exp)
{
ErrorHandler.HandleError(exp, null);
thrownewUtilException(String.Concat(exp.TargetSite, " : ", exp.Message), "err.sqlexception.not.found");
}
catch (Exception exp)
{
ErrorHandler.HandleError(exp, null);
thrownewUtilException(String.Concat(exp.TargetSite, " : ", exp.Message));
}
}
#endregion
ma requete...
privatestaticString UPDATE_PAYS_GASOIL =
"UPDATE PRIXGO_MOIS SET " +
" CODE_PAYS= @CODE_PAYS , " +
" MONTANT = @MONTANT, " +
" AAAAMM= @AAAAMM " +
"WHERE ID_PRIXGO=@ID_PRIXGO"; Code aspx le datagrid.....
<Columns>
<asp:templatecolumn>
<itemstyleWidth="126px"></itemstyle>
<itemtemplate>
<divnoWrapSTYLE="cursor: hand; width: 61px; overflow: hidden; text-overflow: ellipsis"><spantitle='<%#DataBinder.Eval(Container.DataItem,"CODE_PAYS").ToString()%>'><%#DataBinder.Eval(Container.DataItem, "CODE_PAYS").ToString()%></span></div>
</itemtemplate>
</asp:templatecolumn>
<asp:TemplateColumn>
<ItemTemplate>
<tablecellpadding="0"cellspacing="0"align="center">
<tr>
<tdvalign="bottom"width="120px"align="center">
<tb:TextBoxEntierid="PrixGasoil"Width="95px"runat="server"class="bigInputBold"Text='<%# DataBinder.Eval(Container.DataItem,"MONTANT").ToString() %>'/>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStylewidth="120px"/>
</asp:TemplateColumn>
</Columns>
Merci d'avance pour votre aide
prasbanu