Click here to Skip to main content
15,891,136 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionAJAX/Web Services and GET vs. POST Pin
littleGreenDude30-Jan-14 10:03
littleGreenDude30-Jan-14 10:03 
AnswerRe: AJAX/Web Services and GET vs. POST Pin
Gopi Kishan Mariyala31-Jan-14 0:27
Gopi Kishan Mariyala31-Jan-14 0:27 
GeneralRe: AJAX/Web Services and GET vs. POST Pin
littleGreenDude31-Jan-14 1:47
littleGreenDude31-Jan-14 1:47 
GeneralRe: AJAX/Web Services and GET vs. POST Pin
Gopi Kishan Mariyala31-Jan-14 1:50
Gopi Kishan Mariyala31-Jan-14 1:50 
QuestionLoading ascx control Using C# code Pin
Saeed Ansarinejad30-Jan-14 6:48
Saeed Ansarinejad30-Jan-14 6:48 
Questionhow to download xlsx file from sftp & convet into datatable Pin
antony beula30-Jan-14 1:04
antony beula30-Jan-14 1:04 
AnswerRe: how to download xlsx file from sftp & convet into datatable Pin
Richard Deeming30-Jan-14 2:10
mveRichard Deeming30-Jan-14 2:10 
Questionupdate a row in gridview when checkbox is checking (using button) Pin
Member 1036798129-Jan-14 12:12
Member 1036798129-Jan-14 12:12 
all is clear in the title. i have a code but i don't know why it's not working :


C#
protected void btnUpdate_Click(object sender, EventArgs e)
        {
            #region  @
            try
            {
                string myid = string.Empty;
                for (int i = 0; i < gv_enfant.Rows.Count; i++)
                {
                    var chbox = gv_enfant.Rows[i].Cells[0].FindControl("CheckBoxenfant") as CheckBox;
                    var codeenfant = gv_enfant.Rows[i].Cells[0].FindControl("codeenfant") as HiddenField;
                    if (chbox != null && codeenfant != null)
                    {
                        if (chbox.Checked)
                        {
                            myid = codeenfant.Value;
                        }
                    }
                }
                Response.Write("myid = " + myid);
                c.cmd = c.cn.CreateCommand();
                c.cmd.CommandText = "update Enfants set prenom =@prenom,  DateNaissance=@dateNaissance, Scolarise=@scolarise, Activite=@activite where codeEnfants=@codeEnfants";
                if (c.cn.State == ConnectionState.Closed)
                {
                    c.cn.Open();
                }
                c.cmd.Parameters.Add("@prenom", SqlDbType.VarChar);
                c.cmd.Parameters.Add("@dateNaissance", SqlDbType.Date);
                c.cmd.Parameters.Add("@scolarise", SqlDbType.VarChar);
                c.cmd.Parameters.Add("@activite", SqlDbType.VarChar);
                c.cmd.Parameters.Add("@codeEnfants", SqlDbType.Int);

                c.cmd.Parameters["@prenom"].Value = TextBox_NPmodif.Text;
                c.cmd.Parameters["@dateNaissance"].Value = TextBox_DNmodif.Text;
                c.cmd.Parameters["@scolarise"].Value = TextBox_Scolarisemodif.Text;
                c.cmd.Parameters["@activite"].Value = TextBox_Activitemodif.Text;
                c.cmd.Parameters["@codeEnfants"].Value = myid;
                c.cmd.ExecuteNonQuery();
                gv_enfant.DataBind();

                //success!
                Response.Write("<script>alert('Opération reussie')</script>");
               
            }
            catch (SqlException sqlEx)
            {
                //fail!
                //what is the point of cacthing if you do use the exception?
                Response.Write("error" + sqlEx.Message);
                Response.Write("<script>alert ('Erreur lors de la modif!')</script>");
            }
            finally
            {
                if (c.cn.State == ConnectionState.Open)
                {
                    c.cn.Close();
                }
            }
            #endregion
}

thank you
AnswerRe: update a row in gridview when checkbox is checking (using button) Pin
Member 1036798129-Jan-14 12:17
Member 1036798129-Jan-14 12:17 
AnswerRe: update a row in gridview when checkbox is checking (using button) Pin
Richard Andrew x6429-Jan-14 14:07
professionalRichard Andrew x6429-Jan-14 14:07 
AnswerRe: update a row in gridview when checkbox is checking (using button) Pin
vishal.gavle29-Jan-14 20:29
vishal.gavle29-Jan-14 20:29 
QuestionMove items between 2 asp listbox with SQL Data Source and double click event Pin
Member 775837529-Jan-14 5:16
Member 775837529-Jan-14 5:16 
AnswerRe: Move items between 2 asp listbox with SQL Data Source and double click event Pin
Kornfeld Eliyahu Peter29-Jan-14 6:19
professionalKornfeld Eliyahu Peter29-Jan-14 6:19 
AnswerRe: Move items between 2 asp listbox with SQL Data Source and double click event Pin
Prasad Vj2-Feb-14 1:47
professionalPrasad Vj2-Feb-14 1:47 
Questionuser role - web api Pin
miss78629-Jan-14 5:03
miss78629-Jan-14 5:03 
AnswerRe: user role - web api Pin
Deflinek30-Jan-14 0:24
Deflinek30-Jan-14 0:24 
GeneralRe: user role - web api Pin
miss78630-Jan-14 0:43
miss78630-Jan-14 0:43 
GeneralRe: user role - web api Pin
Deflinek30-Jan-14 2:27
Deflinek30-Jan-14 2:27 
GeneralRe: user role - web api Pin
miss78631-Jan-14 0:28
miss78631-Jan-14 0:28 
GeneralRe: user role - web api Pin
Deflinek31-Jan-14 2:19
Deflinek31-Jan-14 2:19 
QuestionIs it good to use Windows Service to schedule any operation on server side in ASP.Net MVC Pin
H.A.Baig28-Jan-14 18:53
H.A.Baig28-Jan-14 18:53 
AnswerRe: Is it good to use Windows Service to schedule any operation on server side in ASP.Net MVC Pin
Deflinek29-Jan-14 0:07
Deflinek29-Jan-14 0:07 
GeneralRe: Is it good to use Windows Service to schedule any operation on server side in ASP.Net MVC Pin
H.A.Baig29-Jan-14 1:39
H.A.Baig29-Jan-14 1:39 
GeneralRe: Is it good to use Windows Service to schedule any operation on server side in ASP.Net MVC Pin
Deflinek29-Jan-14 2:06
Deflinek29-Jan-14 2:06 
GeneralRe: Is it good to use Windows Service to schedule any operation on server side in ASP.Net MVC Pin
H.A.Baig29-Jan-14 7:22
H.A.Baig29-Jan-14 7:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.