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

Leaving FormView state without cancelling

Hello,

I have a LinkButton that I use to open a FormView in ReadOnly mode
"ShowList", and a LinkButton to open the same FormView in the Insert mode
"NewRecord". If the user clicks "ShowList" then a GridView opens up and
they can then select a record to view the record in the FormView. If they
select the "NewRecord" LinkButton, the same FormView opens in Insert mode.

The problem that I am having is that when the user clicks the "NewRecord"
LinkButton to open the form in Insert mode and then click the "ShowList"
LinkButton. The GridView will open, but when I select a record to view, the
FormView doesn't show. I have to re-select the "NewRecord" LinkButton and
then click the "Cancel" button at the bottom of the FormView.

Once I do this, the FormView will work properly in the ReadOnly mode. I
need to show both LinkButtons, so my question is how can I call the cancel
Insert mode event if a user clicks on a LinkButton before canceling the
Insert view?
--
Thanks in advance,

sck10
Protected Sub lbtnCustRev_Command(ByVal sender As Object, ByVal e As
CommandEventArgs)
If e.CommandName = "ShowList" Then
Me.fvCustRev.ChangeMode(FormViewMode.ReadOnly)
ElseIf e.CommandName = "NewRecord" Then
Me.fvCustRev.ChangeMode(FormViewMode.Insert)
End If
End Sub
Apr 29 '06 #1
2 2140
You should be able to accomplish what you want by using the events attached
to the FormView such as "ModeChanged" or "ModeChanging"

Let me know if you have anymore questions.

Shaun McDonnell
Hello,

I have a LinkButton that I use to open a FormView in ReadOnly mode
"ShowList", and a LinkButton to open the same FormView in the Insert
mode "NewRecord". If the user clicks "ShowList" then a GridView opens
up and they can then select a record to view the record in the
FormView. If they select the "NewRecord" LinkButton, the same
FormView opens in Insert mode.

The problem that I am having is that when the user clicks the
"NewRecord" LinkButton to open the form in Insert mode and then click
the "ShowList" LinkButton. The GridView will open, but when I select
a record to view, the FormView doesn't show. I have to re-select the
"NewRecord" LinkButton and then click the "Cancel" button at the
bottom of the FormView.

Once I do this, the FormView will work properly in the ReadOnly mode.
I need to show both LinkButtons, so my question is how can I call the
cancel Insert mode event if a user clicks on a LinkButton before
canceling the Insert view?

sck10

Protected Sub lbtnCustRev_Command(ByVal sender As Object, ByVal e As
CommandEventArgs)
If e.CommandName = "ShowList" Then
Me.fvCustRev.ChangeMode(FormViewMode.ReadOnly)
ElseIf e.CommandName = "NewRecord" Then
Me.fvCustRev.ChangeMode(FormViewMode.Insert)
End If
End Sub

Apr 29 '06 #2
Hi Sck10,

Thanks you for posting.

As for the FormView displaying status issue, I think it is likely caused by
the FormView 's Mode doesn't been changed correctly when you swtich to the
ShowList mode. Since after the user click "NewRecord" button, the FormView
turn into "Insert" mode, if we directly click "ShowList" at that time, the
FormView is still under "Insert" mode, this cause the problem. I think you
can consider use the FormView.ChangeMode method to explicitly set the
FormView's currentMode to "Readonly", e.g:
protected void LinkButtonShowList_Click(object sender, EventArgs e)
{
GridView1.Visible = true;
FormView1.ChangeMode(FormViewMode.ReadOnly);
}

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 1 '06 #3

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

Similar topics

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...
0
by: sdash | last post by:
I'm working on a simple formview screen that should update a SQL Server 2000 record. I'm sure there must be something simple wrong, but when I press update, the screen refreshes and the changes...
4
by: J055 | last post by:
Hi I have 2 update buttons in my FormView ('Apply' and 'OK'). I want both buttons to update the data source but the 'OK' button should redirect afterwards. I can see which button is clicked...
0
by: Theam Kok Ming | last post by:
Hi All, I am a newbie to ASP.Net 2.0 . I would appreciate if anyone can enlighten me on my doubts I am building a simple customer registration website. I have the tables and GridView to...
5
by: Mark Olbert | last post by:
It appears that FormView controls require the >>exact<< same layout of controls and control types in the various templates in order to function properly. Failure to do so results in a "failure to...
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: John Mason | last post by:
Hi, I've been trying for most of the day to get a FormView control to work. I would like to display a single record, based on a unique user id (loginid), which I am retreiving from a cookie. No...
4
by: pankajsingh5k | last post by:
Hi guys, These question is for all the experts... Please help me before my brain explodes The problem is again with the formview control.. I have a formview and i have to use it that...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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.