473,770 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 VanDetailFormVi ew_ItemCommand( Object sender,
FormViewCommand EventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redire ct("VanList.asp x");
}
}

Is there a better way to do this?

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

Try something like this:

DataGrid1.EditI temIndex = -1;
DataGrid1.DataB ind();
"Dabbler" <Da*****@discus sions.microsoft .com> wrote in message
news:00******** *************** ***********@mic rosoft.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 VanDetailFormVi ew_ItemCommand( Object sender,
FormViewCommand EventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redire ct("VanList.asp x");
}
}

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=" VanDetailFormVi ew_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 VanDetailFormVi ew_ItemCommand( Object sender,
FormViewCommand EventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redire ct("VanList.asp x");
}
}

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.EditI temIndex = -1;
DataGrid1.DataB ind();
"Dabbler" <Da*****@discus sions.microsoft .com> wrote in message
news:00******** *************** ***********@mic rosoft.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 VanDetailFormVi ew_ItemCommand( Object sender,
FormViewCommand EventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redire ct("VanList.asp x");
}
}

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=" VanDetailFormVi ew_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 VanDetailFormVi ew_ItemCommand( Object sender,
FormViewCommand EventArgs e)
{
if (e.CommandName == "Cancel")
{
Response.Redire ct("VanList.asp x");
}
}

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
2321
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 happens and a record gets inserted into my MySQL table but every field that is inserted is NULL. I have a feeling it I am referancing the values incorrectly with my InsertCommand. Here is the insert command: InsertCommand="insert into...
3
6044
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 "LabLocation_ID". With an existing lab, they then need to add the members for that lab. So, what I am trying to do is the following. With the FormView of the Lab open, the user will click a button to open a FormView (InsertMode) and add a new...
0
2208
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 .NET 2.0 DataProvider (iAnywhere.Data.AsaClient.dll) into the GAC so it can be used in the ProviderName property of a SQLDataSource and loads properly at run time. The application I'm writing is a bit more complex than the example I'm about to...
2
4381
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. However, when the user goes to the next page of the grid, the ControlParameter is passing in a null (or the default value) to the FormView. I want to populate the formview with the data from the first item of the grid. I've set...
0
3584
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 OleDbParameterCollection" whenI try to write a new record. Delete and Modify work fine its just the add record function causes the error.
0
4749
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 through an objectdatasource. The paging on my GridView works fine except that when I change the page the FormView does not update. I tried setting the selectedindex to 0 in the GridView's PageIndexChanged event and manually binding the formview...
1
6569
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). The field bounded in the database (MySql) is a string field (ENUM('True','False') default 'False'. The checkbox is correctly bounded in the itemtemplate and in the edititemtemplate.
3
3642
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" runat="server"></asp:Label></td> <td> <asp:TextBox ID="tbResponseText" runat="server" Text='<%#
8
11972
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 which is not a string, for example a custom type Address which contains properties such as StreetAddress, City, County, Country etc how do i bind to those properties on the same form view? I have tried doing Bind("Address.StreetAddress") but...
0
9595
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8891
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.