Error :The DetailsView 'dv' fired event ModeChanging which wasn't handled.

Discussion in 'ASP .Net' started by rote, Jan 29, 2008.

  1. rote

    rote Guest

    I can't get the Detailview in GridView to change to EditMode i keep getting
    error :
    :The DetailsView 'dv' fired event ModeChanging which wasn't handled.

    In the ModeChanging event below i looked for the Detailview and added the
    changeMode but still doesn't work

    protected void dv_ModeChanging(object sender, DetailsViewModeEventArgs e)

    {

    if (e.NewMode == DetailsViewMode.Edit)

    {

    DetailsView gv = new DetailsView();

    gv = (DetailsView)this.GridView1.FindControl("dv");

    gv.ChangeMode(DetailsViewMode.Edit);

    }

    }

    I have a DetailView dv in a GridView GridView1 template like so :
    <asp:TemplateField>

    <ItemTemplate>

    <tr>

    <td>

    <td colspan="100%">

    <div id="div<%# Eval("ID") %>"
    style="display:none;position:relative;left:15px;OVERFLOW: auto;WIDTH:97%" >

    <asp:DetailsView ID="dv" runat="server" Height="50px" Width="125px"

    OnModeChanging="dv_ModeChanging">

    <Fields>

    <asp:TemplateField HeaderText="Name" SortExpression="Name">

    <ItemTemplate>

    <asp:Label ID="lblfname" Text='<%# Eval("Firstname") %>'
    runat="server"></asp:Label>

    </ItemTemplate>

    <EditItemTemplate>

    <asp:Label ID="lblsname" Text='<%# Eval("LastName") %>'
    runat="server"></asp:Label>

    </EditItemTemplate>

    </asp:TemplateField>

    <asp:CommandField ShowEditButton="True" />

    </Fields>


    </asp:DetailsView>

    </div>


    </td>

    </tr>

    </ItemTemplate>

    </asp:TemplateField>

    Any ideas what 'm doing wrong?
    Thanks in advance.
    rote, Jan 29, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arjen
    Replies:
    3
    Views:
    68,721
    JackMcKenzie
    Nov 1, 2007
  2. Vincent
    Replies:
    12
    Views:
    11,910
    Jerry Hui
    Mar 19, 2010
  3. Savvoulidis Iordanis
    Replies:
    3
    Views:
    505
    Savvoulidis Iordanis
    Aug 10, 2008
  4. egsdar
    Replies:
    0
    Views:
    3,057
    egsdar
    Nov 4, 2008
  5. Jason
    Replies:
    0
    Views:
    363
    Jason
    Oct 4, 2006
Loading...

Share This Page