I would like to disable a button on the form if the user is not authorized to
use it.
I've created a custom button and would like for each button to know if it
should be enabled or disabled based on another class that would contain the
users authority levels.
I know I can use the on form load event, but I rather test to see if the
user has access to the button during the buttons OnPaint event? If they
don't have access, I'd like to disable the button. So should I use the
OnPaint event for the button, or is there an event that would be more
appropriate. 5 1694
Button has Enabled property. If it is set to false, it is not drawn and user
can not click on it.
I know that, but when would be a good time to set the buttons enable property
to false if the user doesn't have authority. So should I set it to false
during the button paint event, or some other event.
"Lebesgue" wrote: Button has Enabled property. If it is set to false, it is not drawn and user can not click on it. I know that, but when would be a good time to set the buttons enable
property to false if the user doesn't have authority. So should I set it to false during the button paint event, or some other event.
You should set it to false once, whenever you want. I don't find Paint event
very suitable, try to set it when the conditions deteminig if it should be
available change. It will stay false until you set it to true;
do it on Page_Load()
--
info@donotspam dowhileloop.com http://www.dowhileloop.com web development http://publicjoe.dowhileloop.com -- C# Tutorials
"Vern" <Ve**@discussio ns.microsoft.co m> wrote in message
news:6E******** *************** ***********@mic rosoft.com... I know that, but when would be a good time to set the buttons enable
property to false if the user doesn't have authority. So should I set it to false during the button paint event, or some other event.
"Lebesgue" wrote:
Button has Enabled property. If it is set to false, it is not drawn and
user can not click on it.
How about if I do it during the buttons constructor as follows:
public class ButtonExit : Button
{
public ButtonExit() : base()
{
// If user doesn't have enough authority, then disable this button.
if (!Authorized(Bu ttonSecurityLev el))
{
this.Enabled = false ;
}
}
.....
}
"Landi" wrote: do it on Page_Load()
-- info@donotspam dowhileloop.com http://www.dowhileloop.com web development http://publicjoe.dowhileloop.com -- C# Tutorials "Vern" <Ve**@discussio ns.microsoft.co m> wrote in message news:6E******** *************** ***********@mic rosoft.com... I know that, but when would be a good time to set the buttons enable property to false if the user doesn't have authority. So should I set it to false during the button paint event, or some other event.
"Lebesgue" wrote:
Button has Enabled property. If it is set to false, it is not drawn and user can not click on it. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: MoeJoe |
last post by:
I have an asp.net app that updates SQL server and AD, I wanted to disable the "SAVE" button when its clicked until all data are saved. so I did the followin
in the Page_Loa
If Page.IsPostBack = True The
btnOK.Enabled = Fals
End i
in the btnSave_Clic
btnOK.Enabled = Fals
call SaveSQL(
call SaveAD(
btnOK.Enabled = Tru
|
by: Bin Song, MCP |
last post by:
Hi all
I got a strange problem
In my webform, I have a server-side Button "btnDisable" to save some data and enable or disable all other fields in this form based on the data.
The logic is: on server click event, save data, write a client-side script to set 'ynDisable' to true or false, and then use general client-side code in window's onload event to disable all fields. The code is
function disableFields(
with (window.document
var...
|
by: Jeff |
last post by:
I have a payment form with a submit button. A large percentage of users
double-click the submit button thus submitting their payment information
twice. I would like to use javascript to disable the submit button once
it's been clicked, yet still have the form submit. I can do this in ASP
2.0, however, ASP.Net seems to be adversely affected if you disable the
submit button. Here's how I have it set up...
The submit button is a...
|
by: Barry Gilmore |
last post by:
Is there a way to disable a button after it is clicked?
I am trying to avoid having someone click on it twice while they wait for it
to process.
Thank you!
|
by: Patrick Flaherty |
last post by:
Hi,
Experienced programmer but new to PHP. Moreover I'm to use PHP with Xoops on
top (this adds object orientation?).
I don't seem to find a xoops Usenet group?
Whatever the case (and presumably a Xoops property): how does one disable
(grey-out) a button?
| |
by: bay_dar |
last post by:
Hi, I have an internal ASP.NET application that I'm are using to send
e-mails out based on a single milepost or milepost range entered.
I'm trying to do two things when a user clicks on the submit button
to submit a form that contains one or two Mileposts:
1) If a Milepost range larger than 5 miles is entered, I would
like to
pop up a confirmation box to confirm the range.
|
by: mc |
last post by:
I'm writing an app for managing Task Lists, I'm trying to add some
controls to a form that I can use to link tasks, my original intention
was to: -
Add two list boxes, one listing "all Tasks" and the other listing
"Linked Tasks", I have two buttons which in javascript move items from
the first list into the second.
Then when a user clicks a thrid button I would like to save this data.
|
by: Richard Maher |
last post by:
Hi,
I am in a mouseup event for button A and I'd like to disable=false button B
before starting some work. Is there anyway that an event for button B can
then fire before my event processing for button A's mouseup has completed?
I beleive event processing to be single-threaded for good reason but I need
a "stop" button and it's no good if it doesn't do anything until the other
processing has finished :-)
|
by: Gugale at Lincoln |
last post by:
Hi,
I am creating a user control which has a radio button and few other
controls. I would like the user control to behave like a radio button, in
the sense when added to a container radio button on only one of the user
controls should be selected at any given point of time. I am going to use
this control in different places. What is the best way of designing such a
user control?
Thanks
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |