R
rote
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%" >
<aspetailsView 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>
</aspetailsView>
</div>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
Any ideas what 'm doing wrong?
Thanks in advance.
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%" >
<aspetailsView 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>
</aspetailsView>
</div>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
Any ideas what 'm doing wrong?
Thanks in advance.