Solved

disable a formview

Posted on 2006-06-19
2
555 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
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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