DetailsView won't enter Edit mode?

G

Guest

When I click the "Edit" hyperlink, my DetailsView doesn't enter Edit mode.
It will if I set the DefaultMode="Edit". Any thoughts? Thanks.

<asp:DetailsView ID="DetailsView1" DataKeyNames="TopicId" runat="server"
Height="50px" Width="547px" AutoGenerateEditButton=true
OnModeChanging="DetailsView1_ModeChanging"
OnPageIndexChanging="DetailsView1_PageIndexChanging">
</asp:DetailsView>

protected void DetailsView1_ModeChanging(Object sender,
DetailsViewModeEventArgs e)
{
//do I need to do something here??
}
 
D

David R. Longnecker

You'll need to have an event for your Edit hyperlink that sets you into Edit
mode.

If you're using Commands, you could capture the CommandName.Equals("Edit")
of your ItemCommand event and then run:

protected void DetailsViewObject_ItemCommand(object sender, DetailsViewCommandEventArgs
e)
{
if (e.CommandName.Equals("Edit"))
{
DetailsViewObject.ChangeMode(DetailsViewMode.Edit);
}
}

Or simply anything that fires off the ChangeMode method. After you're done
editing, be sure to swap back to .ReadOnly when you're done.

HTH.

-dl
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top