Asp net detailview itemupdating


I then double-clicked the handler on the property page to create a new code block, inserted my code, and everything worked fine. All the samples I found were using Datas Source ID bound to some damn SQL- or Object Data Source object which forces you to design and maintain (don't get me started) tableadapters using your MOUSE and a wizard or add method parameters to your control structure, blah blah..).

I remember Access (at least Access '97, anyway) used to have the same issue from time to time, and I somehow managed to pull that fact out of long-term memory despite the overload of useless baseball statistics dwelling there. If you want to set the Data Source at runtime, you must set the new mode before actually binding, like in the following sample: protected void Details View1_Mode Changing(object sender, Details View Mode Event Args e) it works from very beginning with datagrid and gridview binding events, pageindexchanged and many others.

I have to click Edit and Cancel twice for them to do their action.

The first and second click are calling the Mode Changing method so I assume there is something wrong with my code and the same with just B's code.

I just noticed after the first time it only takes 1 click to get into edit but still 2 clicks to get out of edit mode.

I just relised this is because the detailsview is not rebound when you go to edit.

You dont have to overide any of the event handlers either - what a daft error that is!!!!! Example: protected void Details View1_Mode Changing(object sender, System. Even when it does change mode, regardless of which control I hit, the program will randomly decide if it is going to go into edit mode or update mode.

Scott I have to say I've had just about enough of this wizard-driven all-your-code-in-one-place orientation you find everywhere in the documentation and samples. Main idea is that after the state is changed you have to rebind your control to make it actually "see" the changes.

the above snippet should be changed like this: Just wanted to add my two cent for those still having this problem.

When in either of these modes, I have to press cancel twice to return to readonly mode.....pretty frustrating. Guys I solved the problem here;s the code, I just called Bind Details View after changing mode to Edit..

It will set to Edit mode and Render correctly when you click on Edit button for first time protected void Page_Load(object sender, Event Args e) private void Bind Detials View() protected void Details View1_Mode Changing(object sender, Details View Mode Event Args e) ).

If I work it out by myself then I'll come back here and let you know so you know what to do in the future if you decide to use a Details View for something.

You must have an account to comment. Please register or login here!