views:

231

answers:

2

hi in details view once i click edit mode. all the controls are getting into edit mode. i make the changes and give update data is updated in database . but still all the controls are in edit mode only "actaully once we give click then update then i should again gone to read only mode means all the values should again be showing in label field"

i am doing this in .cs file only no sqldatadource is used or object datasource

right now this feature is not happening to me. what is the issue here?

looking forward for an solution thank you

+1  A: 

Since you aren't using any built-in code to do the update, you probably need to change the display mode manually during your update.

myDetailsView.ChangeMode( DetailsViewMode.ReadOnly );
tvanfosson
ya added this line of code in ItemUpdating event that is after i do update to database:{ myDetailsView.ChangeMode( DetailsViewMode.ReadOnly );} but i get an error telling that as you are in edit mode you cannot do readonly here
prince23
A: 

you need to put this code in itemupdated event of detailsview rather itemupdating event.

yourDetailsView.ChangeMode(DetailsViewMode.ReadOnly);
Muhammad Akhtar
hi Muhammad Akhtar i have put this code in itemupdated event {yourDetailsView.ChangeMode(DetailsViewMode.ReadOnly);} but this event is not getting fired only afteritemupdating event. is exceuted
prince23
i am placing my detailsview control update panel and have set the update mode ="conditional" there
prince23
protected void DetailsView1_ItemUpdating(object sender, DetailsViewInsertEventArgs e) { Updatedetailsview();DetailsView1.ChangeMode(DetailsViewMode.ReadOnly); BindDetailsView(); }} this was the code which finally made my probmlem solve we can put this code itemupdating event. onlyDetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
prince23