after succesfull insert
-
Hi.. I am using a formView and a data source to insert rows into a db. The defaultmode of formviev is "insert". After a successfull insert operation I want to show user only a succes message. But the default behavior is; formview show again insert new item. How could I change this? karanba
-
Hi.. I am using a formView and a data source to insert rows into a db. The defaultmode of formviev is "insert". After a successfull insert operation I want to show user only a succes message. But the default behavior is; formview show again insert new item. How could I change this? karanba
1. Add a label to your page to output the success message. 2. Raise the FormView iteminserted event. 3. Write an event handler - something like : protected void FormView1_Inserted(Object sender, FormViewInsertedEventArgs e) { // Hide the formview FormView1.Visible=false; Label1.text="Record successfully inserted"; } Remember too you can hide the Label to begin with within Properties. I find the visible attribute very useful. You might also like to look at the example at http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.iteminserted.aspx Hope this helps. Maj
-
1. Add a label to your page to output the success message. 2. Raise the FormView iteminserted event. 3. Write an event handler - something like : protected void FormView1_Inserted(Object sender, FormViewInsertedEventArgs e) { // Hide the formview FormView1.Visible=false; Label1.text="Record successfully inserted"; } Remember too you can hide the Label to begin with within Properties. I find the visible attribute very useful. You might also like to look at the example at http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.iteminserted.aspx Hope this helps. Maj