editable datagrid

csharp France
  • 9 years ago


    I have an editable datagrid with 2 columns one is contry(it is not editable) the other one is an editable column with amount (float)...

    I would to know,how can i update my grid..I don't how can i pick the datas of textbox in datagrid...

    here is my Datagrid:


    <itemstyle Width="126px"></itemstyle>
    <div noWrap STYLE="cursor: hand; width: 61px; overflow: hidden; text-overflow: ellipsis"><span title='<%#DataBinder.Eval(Container.DataItem,"CODE_PAYS").ToString()%>'><%#DataBinder.Eval(Container.DataItem, "CODE_PAYS").ToString()%></span></div>
    <table cellpadding="0" cellspacing="0" align="center">
    <td valign="bottom" width="120px" align="center">

    <tb:TextBoxEntier id="PrixGasoil" Width="95px" runat="server" class="bigInputBold" Text='<%# DataBinder.Eval(Container.DataItem,"MONTANT").ToString() %>'/>

    <ItemStyle width="120px"/>

    This is my query:

    private static String UPDATE_PAYS_GASOIL =
    " CODE_PAYS= @CODE_PAYS , " +
    " MONTANT = @MONTANT, " +
    " AAAAMM= @AAAAMM " +

    #region updatePays
    public static DataSet updatePays(String sCodePays, float fMontant, String sAaaamm, TxHelper oTxHelper)
    SqlParameter[] sqlParameters = new SqlParameter[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);
    throw new UtilException(String.Concat(exp.TargetSite, " : ", exp.Message), "err.sqlexception.not.found");
    catch (Exception exp)
    ErrorHandler.HandleError(exp, null);
    throw new UtilException(String.Concat(exp.TargetSite, " : ", exp.Message));

    Then this my validation button:

    protected void ValiderPrix_Btn_Click(object sender, EventArgs e)
    FacturationCmd oFacturationCmd = new FacturationCmd();
    oFacturationCmd.iAction =
    oFacturationCmd.sCodePays = oFacturationCmd.sCodePays;
    oFacturationCmd.sAaaamm = AnneeEnCours_Label.Text;
    //oFacturationCmd.fMontant = ;
    catch (UtilException ex)
    ErrorHandler.HandleError(ex, null);
    catch (Exception ex)
    ErrorHandler.HandleError(ex, null);


    Advance thanks for your help,pls let me know if u don't understand...

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“If debugging is the process of removing software bugs, then programming must be the process of putting them in.” - Edsger Dijkstra