473,327 Members | 1,892 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,327 software developers and data experts.

use Formview cancel commandname to return to GridView Page?

I'm trying to code a FormView page to return to the Gridview List if the user
clicks the Cancel button while in insert mode but nothing happens with the
following code:

void VanDetailFormView_ItemCommand(Object sender,
FormViewCommandEventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redirect("VanList.aspx");
}
}

Is there a better way to do this?

Thanks.
Mar 20 '06 #1
4 8605
I think you'll just want to take the Grid out of editmode

Try something like this:

DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind();
"Dabbler" <Da*****@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
I'm trying to code a FormView page to return to the Gridview List if the
user
clicks the Cancel button while in insert mode but nothing happens with the
following code:

void VanDetailFormView_ItemCommand(Object sender,
FormViewCommandEventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redirect("VanList.aspx");
}
}

Is there a better way to do this?

Thanks.

Mar 20 '06 #2
If you want to consume the ItemCommand, make sure you wired the event for it
properly, e.g. add in the markup of the FormView:
OnItemCommand="VanDetailFormView_ItemCommand"
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
I'm trying to code a FormView page to return to the Gridview List if the user
clicks the Cancel button while in insert mode but nothing happens with the
following code:

void VanDetailFormView_ItemCommand(Object sender,
FormViewCommandEventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redirect("VanList.aspx");
}
}

Is there a better way to do this?

Thanks.

Mar 20 '06 #3
Thanks Anthony but I'm actually using a formView on a different page than the
GridView.

"Anthony Merante" wrote:
I think you'll just want to take the Grid out of editmode

Try something like this:

DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind();
"Dabbler" <Da*****@discussions.microsoft.com> wrote in message
news:00**********************************@microsof t.com...
I'm trying to code a FormView page to return to the Gridview List if the
user
clicks the Cancel button while in insert mode but nothing happens with the
following code:

void VanDetailFormView_ItemCommand(Object sender,
FormViewCommandEventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redirect("VanList.aspx");
}
}

Is there a better way to do this?

Thanks.


Mar 20 '06 #4

Thanks Phillip, that's the ticket! I guess I need to read up on these
builtin GridView events vs the ones I need to add to understand the
interaction between them and my own handlers.

Thanks again!

"Phillip Williams" wrote:
If you want to consume the ItemCommand, make sure you wired the event for it
properly, e.g. add in the markup of the FormView:
OnItemCommand="VanDetailFormView_ItemCommand"
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
I'm trying to code a FormView page to return to the Gridview List if the user
clicks the Cancel button while in insert mode but nothing happens with the
following code:

void VanDetailFormView_ItemCommand(Object sender,
FormViewCommandEventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redirect("VanList.aspx");
}
}

Is there a better way to do this?

Thanks.

Mar 20 '06 #5

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

Similar topics

1
by: pete | last post by:
I seem unable to get the FormView with the SqlDataSource control in ASP.NET 2.0 beta 2 to insert into my MySQL 4.11 database corectly. When I run the page and click on the Insert link a SQL insert...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
0
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase...
2
by: Bob | last post by:
Hi All: I have a GridView with several pages and a FormView linked via a ControlParameter. The FormView populates correctly when the user makes a selection from the first page of the grid. ...
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...
1
by: Pao | last post by:
I have a formview bounded to an objectdatasource. All ok but I have some trouble with a checkbox: when I am in update mode and I update the record, this field is never updated (no errors thrown)....
3
by: J055 | last post by:
Hi I have a PlaceHolder control inside a FormView EditItemTemplate: <asp:PlaceHolder ID="phResponseText" runat="server"> <tr> <td> <asp:Label ID="lblResponseText"...
8
by: =?Utf-8?B?QXNo?= | last post by:
Hi, I have an object, for example User. User contains various properties which i have been able to bind to successfully using wizards and the form view. However if the class User has a property...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.