473,387 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

GridView & FormView

[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 }=-
Jul 27 '06 #1
1 2674
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 }=-
Jul 27 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dabbler | last post by:
What's the best way to return to GridView after editing a detail record in a FormView so the GridView shows the page with the edited record on it? I'm using GridView with standard...
1
by: joechipubik | last post by:
I have a GridView in a FormView that has as its datasource a DataTable that is stored in the session cache. When I first load the page the GridView is displayed correctly, but on subsequent loads...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
0
by: ThePurpleCat | last post by:
Hi, I'm a newbie to ASP.NET programming but not to Visual Studio. I'm having trouble getting my Master-Details page to work. I have a page enabled GridView which is linked to a FormView control...
2
by: needin4mation | last post by:
In a GridView, take for example a delete button. When I click the delete button in my GridView the GridView row is deleted and the GridView rebinds and refreshes the records to show accurately. ...
0
by: Q. John Chen | last post by:
I have a GridView and a FormView serve as master/detail relation. The GridView has paging enabled - 10 rows/page. The formView is linked to gridView's SelectedValue as the sole parameter. ...
2
by: sck10 | last post by:
Hello, I have a web page that has a GridView and a FormView, each in its own panel. The GridView shows a list of records in a database. When a row in the GridView is selected the FormView...
0
by: LiamLiamLiam | last post by:
G'day all. I having a problem with my formview. I'll ty to explain my situation as best as i can. I have a page with a search field at the top which is just a simple asp:textbox. Below that i...
5
by: =?Utf-8?B?QWRhciBXZXNsZXk=?= | last post by:
Hi All, I have a GridView inside the EditItemTemplate of a FormView. Both FormView and GridView are data bound using an ObjectDataSource. When the FormView's ObjectDataSource object has a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.