Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can't change mode in FormView

Reply
Thread Tools

Can't change mode in FormView

 
 
staeri@gmail.com
Guest
Posts: n/a
 
      04-13-2006
I have a FormView with DefaultMode="Insert".

I want to change this to DefaultMode="Edit" with code but this doesn't
work. It's still in insert mode. I've used the following code:

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

What is wrong? If I change to DefaultMode="Edit" manually in the aspx
file it works but not with code.

Very grateful for fast help!

Regards,

S

 
Reply With Quote
 
 
 
 
staeri@gmail.com
Guest
Posts: n/a
 
      04-13-2006
When I change to the following code it works:

Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Me.Load
If (Not IsPostBack) Then
If Len(Request.QueryString("Mode")) > 0 Then
FormView1.ChangeMode(FormViewMode.Edit)
FormView1.DefaultMode = FormViewMode.Edit
End If
End If
End Sub

What does Handles Me.Load do?

Regards,

S

 
Reply With Quote
 
 
 
 
Christopher Reed
Guest
Posts: n/a
 
      04-17-2006
Handles Me.Load actually causes your Page_Load method to execute. That was
your problem earlier when you couldn't change values.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

<> wrote in message
news: oups.com...
> When I change to the following code it works:
>
> Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Me.Load
> If (Not IsPostBack) Then
> If Len(Request.QueryString("Mode")) > 0 Then
> FormView1.ChangeMode(FormViewMode.Edit)
> FormView1.DefaultMode = FormViewMode.Edit
> End If
> End If
> End Sub
>
> What does Handles Me.Load do?
>
> Regards,
>
> S
>



 
Reply With Quote
 
staeri@gmail.com
Guest
Posts: n/a
 
      04-20-2006
But I've user Page_Load in other situations before without the Me.Load
and everything has been executed then.

Should Me.Load always be used?

 
Reply With Quote
 
Christopher Reed
Guest
Posts: n/a
 
      04-20-2006
It may have something to do with the AutoEventWireup attribute in the @Page
directive. Since I'm a C# programmer, I'm not really sure, but I'll
research it and reply back (unless a VB guru can respond faster).
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

<> wrote in message
news: oups.com...
> But I've user Page_Load in other situations before without the Me.Load
> and everything has been executed then.
>
> Should Me.Load always be used?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best place to change formview mode David C ASP .Net 0 12-14-2007 03:19 PM
FormView doesn't change its mode ma ASP .Net 0 10-08-2007 09:06 AM
Formview dropdownlist won't populate in insert mode, but does in edit mode ??? jobs at webdos ASP .Net Web Controls 0 10-09-2006 03:38 PM
Controlling MultiView ActiveViewIndex after FormView Mode change Martin ASP .Net 1 06-27-2006 03:09 PM
Safe Mode (?) - It is meant to be normal mode but looks like safe mode English Patient Computer Support 3 10-03-2004 11:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57