Thursday, March 22, 2012

Set mode in FormView on Page_Load

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,

Stry

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.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

<staeri@.gmail.com> wrote in message
news:1144144823.902803.185090@.i39g2000cwa.googlegr oups.com...
> 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

0 comments:

Post a Comment