return value wont save
-
hi all, i have a showmodaldialog and after getting value from B page the value is stored in textbox now everything is ok but save button wont take new value and returns the old one, is there something i should do, i will put the code of save button maybe it would help :- SqlConnection con = new SqlConnection(sConnectionString); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; if (ViewState["Edit"].ToString().Equals("Edit")) { cmd.CommandText = "BaselAnfouqa_Upd"; cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = nUserID; } else { cmd.CommandText = "BaselAnfouqa_Ins"; } cmd.Parameters.Add("@UserName", SqlDbType.VarChar, 50).Value = tbUserName.Text; cmd.Parameters.Add("@Password", SqlDbType.Int).Value = tbPassword.Text; cmd.Parameters.Add("@Salary", SqlDbType.Float).Value = tbSalary.Text; cmd.Parameters.Add("@Gender", SqlDbType.Char, 10).Value = ddlGender.SelectedValue; cmd.Parameters.Add("@DateOfBirth", SqlDbType.DateTime).Value = tbDateOfBirth.Text.ToString(); cmd.Parameters.Add("@Status", SqlDbType.Int).Value = ddlStatus.SelectedValue; con.Open(); cmd.ExecuteNonQuery(); vBindgvClients(); mvMainPage.SetActiveView(viewClients); thx in advance.
-
hi all, i have a showmodaldialog and after getting value from B page the value is stored in textbox now everything is ok but save button wont take new value and returns the old one, is there something i should do, i will put the code of save button maybe it would help :- SqlConnection con = new SqlConnection(sConnectionString); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; if (ViewState["Edit"].ToString().Equals("Edit")) { cmd.CommandText = "BaselAnfouqa_Upd"; cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = nUserID; } else { cmd.CommandText = "BaselAnfouqa_Ins"; } cmd.Parameters.Add("@UserName", SqlDbType.VarChar, 50).Value = tbUserName.Text; cmd.Parameters.Add("@Password", SqlDbType.Int).Value = tbPassword.Text; cmd.Parameters.Add("@Salary", SqlDbType.Float).Value = tbSalary.Text; cmd.Parameters.Add("@Gender", SqlDbType.Char, 10).Value = ddlGender.SelectedValue; cmd.Parameters.Add("@DateOfBirth", SqlDbType.DateTime).Value = tbDateOfBirth.Text.ToString(); cmd.Parameters.Add("@Status", SqlDbType.Int).Value = ddlStatus.SelectedValue; con.Open(); cmd.ExecuteNonQuery(); vBindgvClients(); mvMainPage.SetActiveView(viewClients); thx in advance.
where is the code that is suppose to store the value when the button is Clicked
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
hi all, i have a showmodaldialog and after getting value from B page the value is stored in textbox now everything is ok but save button wont take new value and returns the old one, is there something i should do, i will put the code of save button maybe it would help :- SqlConnection con = new SqlConnection(sConnectionString); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; if (ViewState["Edit"].ToString().Equals("Edit")) { cmd.CommandText = "BaselAnfouqa_Upd"; cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = nUserID; } else { cmd.CommandText = "BaselAnfouqa_Ins"; } cmd.Parameters.Add("@UserName", SqlDbType.VarChar, 50).Value = tbUserName.Text; cmd.Parameters.Add("@Password", SqlDbType.Int).Value = tbPassword.Text; cmd.Parameters.Add("@Salary", SqlDbType.Float).Value = tbSalary.Text; cmd.Parameters.Add("@Gender", SqlDbType.Char, 10).Value = ddlGender.SelectedValue; cmd.Parameters.Add("@DateOfBirth", SqlDbType.DateTime).Value = tbDateOfBirth.Text.ToString(); cmd.Parameters.Add("@Status", SqlDbType.Int).Value = ddlStatus.SelectedValue; con.Open(); cmd.ExecuteNonQuery(); vBindgvClients(); mvMainPage.SetActiveView(viewClients); thx in advance.
Put a breakpoint on the line here, and inspect what is the value of the Textbox in the server side. Does it have the latest values ? Does it have anything to deal with This ??[^] :confused:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
where is the code that is suppose to store the value when the button is Clicked
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
shown at 1st question page
-
shown at 1st question page
what is "BaselAnfouqa_Upd" ?
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
what is "BaselAnfouqa_Upd" ?
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
:) its a stored procedure