B
Brad Baker
I have created a usercontrol (ascx file) which contains a formview, inside
of the formview I have an EditItemTemplate and an ItemTemplate. Both the
EditItemTemplate and ItemTemplate have link buttons which call some code to
changed the formview mode from Edit to ReadOnly or vice versa. When I run
the code though and click the link buttons, the formview doesn't switch
modes (the page reloads the mode just doesn't change)
Here is the code which switches modes:
protected void view_linkbutton_click(object sender, EventArgs e)
{
formview.ChangeMode(FormViewMode.ReadOnly);
}
protected void edit_linkbutton_click(object sender, EventArgs e)
{
formview.ChangeMode(FormViewMode.Edit);
}
Here is an excerpt of the formview:
<asp:FormView ID="formview" runat="server"
DataSourceID="formview_datasource" Width="100%" DefaultMode="ReadOnly">
<EditItemTemplate>
<table>
<td> Mode:</td>
<td><asp:LinkButton ID="ViewLinkButton" runat="server"
OnClick="view_linkbutton_click">View</asp:LinkButton>
|
<asp:LinkButton ID="EditLinkButton" runat="server"
OnClick="edit_linkbutton_click">Edit</asp:LinkButton></td>
</EditItemTemplate>
<ItemTemplate>
<table>
<td> Mode:</td>
<td><asp:LinkButton ID="ViewLinkButton" runat="server"
OnClick="view_linkbutton_click">View</asp:LinkButton>
|
<asp:LinkButton ID="EditLinkButton" runat="server"
OnClick="edit_linkbutton_click">Edit</asp:LinkButton></td>
</ItemTemplate>
This code previously worked before I moved it from default.aspx to a user
control (ascx) file. So I can't seem to figure out why its stopped working.
Do I need to reference the formview differently now that I moved it to the
ascx file?
Thanks
Brad
of the formview I have an EditItemTemplate and an ItemTemplate. Both the
EditItemTemplate and ItemTemplate have link buttons which call some code to
changed the formview mode from Edit to ReadOnly or vice versa. When I run
the code though and click the link buttons, the formview doesn't switch
modes (the page reloads the mode just doesn't change)
Here is the code which switches modes:
protected void view_linkbutton_click(object sender, EventArgs e)
{
formview.ChangeMode(FormViewMode.ReadOnly);
}
protected void edit_linkbutton_click(object sender, EventArgs e)
{
formview.ChangeMode(FormViewMode.Edit);
}
Here is an excerpt of the formview:
<asp:FormView ID="formview" runat="server"
DataSourceID="formview_datasource" Width="100%" DefaultMode="ReadOnly">
<EditItemTemplate>
<table>
<td> Mode:</td>
<td><asp:LinkButton ID="ViewLinkButton" runat="server"
OnClick="view_linkbutton_click">View</asp:LinkButton>
|
<asp:LinkButton ID="EditLinkButton" runat="server"
OnClick="edit_linkbutton_click">Edit</asp:LinkButton></td>
</EditItemTemplate>
<ItemTemplate>
<table>
<td> Mode:</td>
<td><asp:LinkButton ID="ViewLinkButton" runat="server"
OnClick="view_linkbutton_click">View</asp:LinkButton>
|
<asp:LinkButton ID="EditLinkButton" runat="server"
OnClick="edit_linkbutton_click">Edit</asp:LinkButton></td>
</ItemTemplate>
This code previously worked before I moved it from default.aspx to a user
control (ascx) file. So I can't seem to figure out why its stopped working.
Do I need to reference the formview differently now that I moved it to the
ascx file?
Thanks
Brad