FormView problem

G

Geek

Guys,

I am working on a project, and I thought using FormView will help good
but I am running into a issue. What I have done is that in Form View in
Footer template icluded a Link Button which is servind as an edit
command. When user click it should change the Formview to Edit mode.
But when I click first on it is changing the mode to edit, it is not
diplaying the Edit Item template, I have to click again in order to get
into Edit Item template. This is getting little frustrating for me. Can
any one tell me what is going on here. Thanks,

Protected Sub LinkButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
FrmView.ChangeMode(FormViewMode.Edit)
FrmView.DefaultMode = FormViewMode.Edit

end sub
 
G

Guest

Why are you changing both the current mode and the default mode of the
formview to edit mode? Have you tried leaving the below line out?

FrmView.DefaultMode = FormViewMode.Edit
 
G

Geek

yeah I did, Initially it wasn't there I was reading another forum I
thought I might need to use it just to enforce the Formivew. But
somehow it is not renedering properly even without that. And I debugged
it when I click on the link button it runs thoruhg that lin of cade and
I am getting no exceptions anywhere else.
 
G

Geek

Here is the code too if you want to take a look at it. I used an if
statement just for debugging purpose. I tried to see if ChangeMode
statement needs to run twice in order to work properly but thats not
the case at all. For some odd reason you have to click button second
time in order to get the EditItemTemplate to appear. And after fighting
with this I am starting to give up. I debugged my pages even from
Page_Load() function and there is nothing that can be a problem or in a
way of this event. Thanks, for your help on this.

'If (FrmView.CurrentMode = FormViewMode.ReadOnly And Page.IsPostBack)
Then
FrmView.ChangeMode(FormViewMode.Edit)



Response.Write(FrmView.CurrentMode.ToString())

'End If
 

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,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top