Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0FormView OnModeChanged not firedFormView OnModeChanged not fired
Previous
 
Next
New Post
10/9/2006 9:37 AM
 
Hi,
 
I have a module with FormView control and the OnModeChanged event set.
I also declared the event handler and placed some code inside.
Then I defined an Edit button inside the ItemTemplate so that when the user clicks it I should get called inside the mode change handler.
 
However, I don't see this event handler called, even when I run under the debugger with a breakpoint.
I followed all the samples I could find about the subject, search the forum for advice, but I am not able to figure out why my event is not getting called....
 
This also happen if I define another buttom (such as ImageButton) inside the FormView and try to use it's OnClick event.
 
Any idea???
 
Thanks!
 
Ofer
 
 
New Post
10/9/2006 6:11 PM
 

The ModeChanged event is raised when a FormView control attempts to switch between edit, insert, and read-only mode, but after the mode actually changes. This allows you to provide an event-handling method that performs a custom routine, such as synchronizing the FormView control with another control, whenever this event occurs.

For Example:

Say in your html you have a FormView declared like:

<asp:formview id="FormView1"
        datasourceid="FormViewSource"
        allowpaging="true"
        datakeynames="ItemID"
        headertext="Read-Only Mode"
        headerstyle-backcolor="Green"
        emptydatatext="No records found."
        onmodechanged="FormView1_ModeChanged" 
        runat="server">

Then in your codebehind you have your ModeChanged subroutine.

Sub FormView1_ModeChanged(ByVal sender As Object, ByVal e As EventArgs)
   'Display the current mode in the header row.
   Select Case FormView1.CurrentMode

     Case FormViewMode.Edit
       FormView1.HeaderText = "Edit Mode"
       FormView1.HeaderStyle.BackColor = System.Drawing.Color.Red

     Case FormViewMode.ReadOnly
       FormView1.HeaderText = "Read-Only Mode"
       FormView1.HeaderStyle.BackColor = System.Drawing.Color.Green

     Case Else
       FormView1.HeaderText = "Unsupported mode."
       FormView1.HeaderStyle.BackColor = System.Drawing.Color.Yellow

   End Select
End Sub


If you post some code or give a more detailed explaination of what you are trying to accomplish, we may be able to help more.

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0FormView OnModeChanged not firedFormView OnModeChanged not fired


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out