Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > GridView & FormView

Reply
Thread Tools

GridView & FormView

 
 
Kyle K.
Guest
Posts: n/a
 
      07-27-2006
[Config: ASP.NET v2 on WinXP w/ IIS & Visual Studio .NET 2005]

I would like to build my data pages such that the top of the page
contains a GridView showing the data with 'Enable Select = true'.

Below that I would like to have a FormView, that by default is in
'Insert' mode for creating a new record.

If the user 'selects' a record in the GridView above, I would like to
set the FormView to 'Edit' mode with the 'selected' record data loaded
in it for editing. I would use the built-in editing features of the
GridView, but the page has fixed width margins that make this almost
impossible.

The problem I am having is that during the post-back, the FormView
always gets reset to 'Insert' mode, no matter what I try.

Thanks for any help.

-={ Kyle }=-
 
Reply With Quote
 
 
 
 
cannontrodder
Guest
Posts: n/a
 
      07-27-2006
Hi Kyle,

I'm not sure what you have tried so far but I am doing the exact same
thing. In the "SelectedIndexChanged" event of your gridview use the
following:

YourFormView.ChangeMode(FormViewMode.Edit)

The cancel button in your formview will make it go back to insert
automatically.

If you are using sorting on your gridview, I advise the following in
the gridview's "Sorted" event also:

GridView.SelectedIndex = -1
YourFormView.ChangeMode(FormViewMode.Insert)

...because the sort may leave the same physical row selected but the
sort will mean a different record will be in it. (This is what is
happening in my gridview bound to a custom sort anyway)

Kyle K. wrote:
> [Config: ASP.NET v2 on WinXP w/ IIS & Visual Studio .NET 2005]
>
> I would like to build my data pages such that the top of the page
> contains a GridView showing the data with 'Enable Select = true'.
>
> Below that I would like to have a FormView, that by default is in
> 'Insert' mode for creating a new record.
>
> If the user 'selects' a record in the GridView above, I would like to
> set the FormView to 'Edit' mode with the 'selected' record data loaded
> in it for editing. I would use the built-in editing features of the
> GridView, but the page has fixed width margins that make this almost
> impossible.
>
> The problem I am having is that during the post-back, the FormView
> always gets reset to 'Insert' mode, no matter what I try.
>
> Thanks for any help.
>
> -={ Kyle }=-


 
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
Formview within Formview Chris ASP .Net 0 05-19-2007 04:12 PM
FormView/Repeater/ Eval(FormView data) David Thielen ASP .Net Web Controls 2 06-16-2006 07:56 PM
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
use Formview cancel commandname to return to GridView Page? =?Utf-8?B?RGFiYmxlcg==?= ASP .Net 4 03-20-2006 06:25 PM
Bind profile custom properties (from web.config) to gridview or formview Giorgio ASP .Net 0 01-09-2006 07:49 PM



Advertisments