.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Enable/Disable controls dynamically based on User settings

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :WPF
 
In my project I have a requirement that all controls in each window shall be enabled or visible dependent on user and the admin shall be able to change is a user will be able to use or see the control. I made a very simple test application that creates a user and gives him a list (will be loaded from db in real app) of the name of the controls in the window and also his settings. Then after initializing the window I use reflection to find the controls and set their isenabled/visibility properties. This solution does the thing but I'm wondering if there is a better solution. The main issue here is that each control must be set per user and thus roles wont work appropriate and also that I need to be able to change the settings at runtime.  


View Complete Post


More Related Resource Links

Enable/Disable controls dynamically based on User settings

  

I need an elegant way to enable/disable controls in my WPF application at run time using an external settings file(xml file)

I know this can be done using binding with Visibility/ IsEnabled property for all the controls, but how will i do change that in run time.

I also want to know whether combining the Settings.settings file and use bindings is the way to go.

There is documentation for VS2005 but not for VS2008 related to Settings.settings file approach.

I need recommendation for this type of features in WPF apps

Any help will be highly appreciated.

 

thanks

Sakti


How to dynamically create user controls ?

  

HI,

can you explain how to create user control dynamically in a web form ?When i am creating server controls of user controls are not instantiated and it is not getting initialized .when i am tyying to initialize its properties error occurs tha object instance not created .

Any suggestion ? 


sitemap control user rights enable and disable

  

Hi,

iam using masterpage and sitemap in my project, what i want to is that

if user login is did, based on the user previlage in need to show the sitemap menu page

if user i have the previlage to see the page then i should enable that page otherwise

i need disable that page

looking for the valuable suggestions




Dynamically adding User Controls -- newbie question!

  
I am new to ASP.NET (coming from ColdFusion, thank goodness I'm away from that!).  And I am have THE hardest time understanding how to work with forms in ASP.NET.  Here's what I am doing:Dynamically add User Controls to a PlaceHolder based on some int value (which currently is passed in a HiddenField).Fire an event if the WebControls inside of the User Control change, then handle that event in the Main Page (i.e. save the input to DB)When the user clicks the "Next/Continue" button, the next controls for the next page are loaded.And I guess maybe I just can't seem to get how things work in ASP.NET, because I am really struggling with the general idea of how ASP.NET flows.  Should I be dynamically loading the controls in Page_Init, or Page_Load?  Or should I load the controls when the buttonclick event is fired?Do I have to add the axCtrl.OnDataChange += new EventHandler(HandleAxControlDataChange); line on Page_Load?  Or should I put this in When I first load the UserControl, I need to initialize some WebControls within the UserContorl.  Is there a way to know if I have loaded new user controls into my placeholder?  I can't use Page.IsPostback, because after the first page, every page is a postback from the buttonclick.Any help for this confused newbie would be GREATLY appreciated!!Here's what I have: pu

Enable/Disable controls in a td when checkbox is checked

  
hi,I have a table with 10 rows.Each row having 3 asp controls (checkbox,textbox and dropdownlist).on pageload all controls except checkboxes should be disabled and If we check any checkbox the controls(textbox and dropdownlist) in that row are should be enable.pls reply me.Thanks in Advance.

Permissions:disable controls by roles(access pages too)(dynamically :each new role has special grant

  
HelloI have an application of many pages of consultation and same time I have a module of adding users by roles and creating accounts by role.(the application is ready but i cant manage the roles)the tutorials that i found are very useful to manage roles but its roles fixed before(administrators,supervisors)(http://www.asp.net/security/tutorials/creating-and-managing-roles-vb) if I add a new role (agent) i want to grant to this new role a new access to pages(different access than admin and supervisor) and disable new controlswhy not using checkbox to every new role checking a field related to databaseis it possible?if yes ,how can i begin?Thanks

Enable/Disable Buttons based on another control property

  

Say i have a tab control that displays data of various types, eg EditorTabViewModel (eg. code view of WYSIWYG), PreviewTabViewModel (eg. preview of WYSIWYG) both inheriting from TabViewModel . The implementation is similar to the tutorial on MSDN

I want to enable/disable buttons depending on the active tab, whether its an EditorTabViewModel or a PreviewTabViewModel and maybe based even on properties of the ViewModel?. How can I achieve this?


How to enable edit option for the user details in my settings

  
hi all,

I am new to SharePoint and SharePoint 2010.

I need to edit the user details when he is logged in, in my web Application, let me explain the scenario in detail.

1. User is log's in the application.

2. Clicks on "My Settings".

3. When the user views his details and clicks on the "Edit Item", then the user is not able to edit his profile but get only to "Attach File".

Checks performed by me:

1. Have checked is the user profile service is started for the current application or not (its started).

2. Have checked is the user profile synchronization service is started for the current application or not (its started).

Please help how can it be done as my site is not in the requirement.

thanks a lot for your help,

Arun Kumar :(

How to enable edit option for the user details in my settings

  

hi all,

I am new to SharePoint and SharePoint 2010.

I need to edit the user details when he is logged in, in my web Application, let me explain the scenario in detail.

1. User is log's in the application.

2. Clicks on "My Settings".

3. When the user views his details and clicks on the "Edit Item", then the user is not able to edit his profile but get only to "Attach File".

Checks performed by me:

1. Have checked is the user profile service is started for the current application or not (its started).

2. Have checked is the user profile synchronization service is started for the current application or not (its started).

Please help how can it be done as my site is not in the requirement.

thanks a lot for your help,

Arun Kumar :(


Tab Control - load user controls in tab dynamically when tab is selected

  

I have searched the forum and I cant seem to find the answer to my question, although I have tried some of the hints I have found with no luck....

Can someone show me a working sample (with source code) of a page with a TabContainer and several tabs, with each tab having a user control, but the controls are not added/initialized/shown until the appropriate tab is shown/clicked?

Something like this forum's "Write a New Post" page, where the tabs load after I click on them, and an animated picture displays to show that its loading.

The solution needs to add user controls to the page, not just html into a dynamic populate extender.

I have one user control per tab, and is linked (ala master-child relationship) to the page using a property. My user controls perform long-running web service queries, and I dont want to waste database/computing resources loading content into a tab that the user will never look at.   Right now, all tabs load their content when the page loads, even though the first tab is only shown.

 
As mentioned above, sample code for the page (.aspx and .cs) and the user control (.ascx and .cs) would really help.

 
Thanks!
 


Dynamically loading different numbers of user controls

  

The web page I am trying to (slowly) build should allow users to add whichever user controls they want on their page, and order them whichever way they like.  This is saved in a database.

So each user could have a different number of controls on the page.

I want to load these web user controls dynamically - I am hoping someone could help me edit my code to do this, or at least point me in the right direction.

This is the design code, at the minute the user controls are fixed and are not loaded dynamically.  They user controls are stored in 'blocks' which look like widgets on the page and can be dragged about to different columns.  For each user the layout is stored in the DB i.e. which blocks are in column 1 and which blocks in column 2 etc. 

How could I change this so that it can create a 'block' div for each user control returned from the database and put the user control in that block and in the right column?

 

				<div class="portal-column" id="portal-column-block-list" style="display: none;">
					<div class="block" id="block-1">
						<h1 class="draghandle">Block 1</h1>
						<p><uc1:wuc01 ID="wuc011" runa

enable and disable of controls

  

hi

i am new in sharepoint. can anyone help me on how to enable and disable field control in sharepoint?

the screnario is: once i ticked the checkbox, the date time field shoud be disable or hide. then if will untick it, the field should display or enable.

thanks


Dynamically Create Controls in ASP.NET by Using Visual C# .NET

  
This article demonstrates how to dynamically create a control for an .aspx page. The sample project does the following:
Creates two TextBox controls.
Verifies that the contents (TextBox.text) and the attributes of the TextBox are saved across posts to the server.
Illustrates handling events that are posted by a dynamically-created control

Dynamically Create Controls in ASP.NET with Visual Basic .NET

  
This step-by-step article describes how to dynamically create controls for an ASPX Web page.

The sample project does the following:
It creates two TextBox controls.
It verifies that the TextBox contents (TextBox.text) and attributes are saved across posts to the server.
It describes how events that are posted by a dynamically created control are handled.

dynamically adding sql server columns based on number of files in fileuploader

  

I want to create a new table to sql database at runtime.  The column names would be "Name", "Date", "Event".  I would also like to have one more column name "Image" but the problem is that since the amount of images will vary, I want the application to count the amount of files in the Multiple fileuploader and then add a image column to the table for the respected amount of files. 

For example if i am uploading 3 files in the multiple fileuploader, the names should be "Name", "Date", "Event", "Image1", "image2", Image3"

I also would like that table name to be name dynamically from the textbox Name when the user enters the information.

 

I have the following code to make a new table, but I dont know how to name the fields at runtime like previously asked please help!!!

 

Dim objConn As New SqlConnection("Server=<servername>;uid=<userid>;pwd=<password>;database=master")

objConn.Open()

UI Datepicker and web user controls

  

Hi,

I have developed an application using the Master-Detail pattern described in this Matt Berseth article.

The only difference between Matt's article and me is that I am using a FormView object in place of a DetailsView.

Everything works fine except that the formview object, in my case it's inside a user control and I can't figure out how to use the jquery datepicker UI plugin.

I have tried to put the script block for the datepicker either in the aspx page as well as inside the user control but in both cases the calendar does not come up when the related textbox get the focus.

Any suggestion on how to work with the datepicker inside an ascx?

thanks in advance!



Persist data in a dynamically populated ListBox in a user control

  

Hi All,

I am trying to persist data in a dynamically populated ListBox in a user control. Here are the details

I have a user control which contains a a listBox and button. On Page_Load of user control I am populating the ListBox control with some values. On Click of button, I am trying to fetch the values which I have selected in ListBox. Though this seems very simple and straight forward I am unable to fetch values.

My Page_Load Function

void Page_Load(object sender, EventArgs e)

{

       If(!IspostBack)

        {

              listBox.items.Add("Item1");

             listBox.items.Add("item2");

             listBox.items.Add("item3");

         }

}

 

My Click Function

Protected Void Button1_Click(object sender, EventArgs e)

{

       string strValue = listBox.SelectedValue

}

 

I have placed brake point at Page_Load and on click function, I am seeing that the moment the breakpoin

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend