Click here to Skip to main content
15,905,874 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi ,

Iam Prasanna I design dhtml form and am getting values from database into the form when updating values in the form it is not saving to the database it is not updating into the database.So please help me

Iam developing asp.net mvc3 application
Iam Using visualstudio 2010
Iam using mysql database
Iam getting no errors
Posted
Comments
bbirajdar 11-May-12 7:37am    
Are you sure you are clicking the 'Save/Update' button ? Please try clicking the 'Save/Update' button. It is necessary to click this button to save the form data to MySQL database..
Sandeep Mewara 11-May-12 7:56am    
not saving to the database it is not updating into the database
Iam getting no errors

You mean that execution goes all well and you dont see record in your DB? Debugged?
Prasanna Kumari 11-May-12 8:08am    
yes code is executing when i click display values are getting but when i click save values are not updating

1 solution

Hi Prasanna. Well as I see you haven't explained the procedure how you're trying to save the data back into the database. I suggest you to set your code inside "Page_Load" event handler to check if its a postback using "IsPostBack" . like:
C#
protected void Page_Load(object sender, EventArgs e)
{            
  if (!IsPostBack)
  {
    // code goes here.
  }
}


What happens behind this is each time a server side control creates a postback event first it executes the Page_Load event.

Hope this help you.

Rgds,
Sunny
 
Share this answer
 
v2
Comments
Prasanna Kumari 11-May-12 8:06am    
ok Thanks For the reply i will try if not get i will send code
Prasanna Kumari 11-May-12 8:07am    
One question in controller only i had to write this code right sir....
Sunny_Kumar_ 11-May-12 8:23am    
you just need to check if its a postback on "OnLoad" event. It means all the code inside "OnLoad" event executes only when the page loads, not on postbacks.
bbirajdar 11-May-12 8:13am    
@Sunnykumar08 .. There is no Page-Load event in MVC3
Prasanna Kumari 11-May-12 8:18am    
page_load event is there but where to write in controller or view

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900