Set mode in FormView on Page_Load

  • Thread starter Thread starter staeri
  • Start date Start date
S

staeri

I'm trying to set the FormView in insert mode but nothing happens with
this code:

Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs)
FormView1.ChangeMode(FormViewMode.Insert)
End Sub

If I click the New button on the form everything works but not with
code.

Can someone please help me?

Regards,

S
 
try

Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) handles Me.Load
 
Try this inside your Page_Load:

If (Not IsPostBack) Then
FormView1.DefaultMode = FormViewMode.Insert
End If

Then again, I'm not sure if you're showing enough code.
 
Back
Top