By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

Leaving FormView state without cancelling

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.