Solved

disable a formview

Posted on 2006-06-19
2
573 Views
Last Modified: 2008-02-01
In ASP.Net 2.0 I have  a page with a formview .
Its default mode is readonly and there there is a button of new and when it is pressed the fromview in
insert mode is shown.
I want to make a check while pressing the New and in a certain case not to enable the insert view.
I thought to do it in the event itemcommand.
My question is how to disable the insert show in a certain case.
Thankyou
Anat.
0
Comment
Question by:ANAT2403
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
e1v earned 500 total points
ID: 16933449
Add a ModeChanging event handler like this to your FormView: (shown in c#)

protected void FormView1_ModeChanging(object sender, FormViewModeEventArgs e)
{
    bool yourCheckHere = true;
    if (e.NewMode == FormViewMode.Insert && yourCheckHere) e.Cancel = true;
}



0
 
LVL 7

Expert Comment

by:kGenius
ID: 16933496

If YOUR CONDITION = true Then
  FormView1.ChangeMode(FormViewMode.ReadOnly)
Else
  FormView1.ChangeMode(FormViewMode.Insert)
End If
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question