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

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

MVVM - Refreshing buttons enable/disable state

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :WPF

Hi everyone... something is working wrong on my MVVM App.

I have a view with the following buttons

    <Button Command="{Binding ShowPlayersCommand}">Show Users</Button>
    <Button Command="{Binding ExitCommand}">Close</Button>

The idea is to show a new window when

View Complete Post

More Related Resource Links

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?

Enable/Disable "Edit" and "Check In" buttons in Ribbon

We want to enable or disable "Edit" or "check in" buttons in ribbon depending upon code run in C#. We have visited a lot of resource but mostly describes for custom buttons. We need to do this for buttons provided out of the box. Any help?

Checkbox disable/enable


I hope someone can be kind enough to help/advise me with this.

I have a web form with multiple checkboxes on it , with one of the checkboxes as the main (controlling) checkbox.  By this I mean that when this main checkbox is checked then all the other checkboxes need to be disable and when its unchecked these other checkboxes need to be enable.

I've found (plenty of) code to do this in javascript but i would really prefer to to it in vb(.net), if possible.

I hope all this makes sense to you.


sitemap control user rights enable and disable



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

TabControl - Disable/Enable tab page

I have a tabcontrol with 2 pages. OnLoad the 2nd Tabpage shall be disabled (grayed out and not selectable). Later with code I need to enable the 2nd tab. Any Ideas how this can be done? please./Morten

Cannot enable Ribbon Edit Tab buttons and "connect" them to a list item in my custom webpart

I have one list with some custom fields and I want to develop a custom page. So, I created an ASPX page and added my custom webpart. This webpart has just a RichTextField, in edit mode, "linked" to one item of the list, like below: SPSite _SPSite = SPContext.Current.Site; SPWeb _SPWebProjects = _SPSite.OpenWeb("/Projects"); SPList _SPListProject = _SPWebProjects.GetList("/Projects/Lists/Project"); int _ID = Convert.ToInt32(this.Page.Request.QueryString["ID"]); RichTextField _RTF = new RichTextField(); _RTF.ID = "RTF"; _RTF.ControlMode = SPControlMode.Edit; _RTF.FieldName = "History"; _RTF.ItemContext = SPContext.GetContext(HttpContext.Current, _ID, _SPListProject.ID, _SPListProject.ParentWeb); _RTF.RenderContext = SPContext.GetContext(HttpContext.Current, _ID, _SPListProject.ID, _SPListProject.ParentWeb); this.Controls.Add(_RTF);   Then, I "turned on" the edit tab on the ribbon by doing the follow: protected override void OnPreRender(EventArgs e) { SPRibbon _CurrentRibbon = SPRibbon.GetCurrent(this.Page); _CurrentRibbon.TrimById("Ribbon.WebPartPage"); _CurrentRibbon.MakeTabAvailable("Ribbon.ListForm.Edit", string.Empty); _CurrentRibbon.MakeContextualGroupInitiallyVisible("Ribbon.ListForm.Edit", string.Empty); _CurrentRibbon.Minimized = false; _CurrentRi

Enable Disable Save Button in Winforms App

Hi, In our windows forms application we have many forms with "Save" buttons. We want to enable them only if the data in the form is changed. At the moment it is handed by adding flags to check whether the data is dirty. Is there any easy way to handle this? May be something with the famework? Thanks,CJ

How to conditionally Enable/Disable Button control using JavaScript ?

hi all... i have a Button control & a TextBox control on my web page. The Button control is initially Disabled. I want that while typing into TextBox, when the length of the contents of TextBox reaches to 12 (i.e. when i type 12th character), the Button Control should be Enabled & if the length again comes down to less than 12, the Button control should again be Disabled... How can i do this using JavaScript...?? Does anyone know how to do this...?? Please help. It's urgent... Thanx in advance to all posts !

WPF, MVVM, Commands from buttons within a Listbox ItemTemplate? (code included)

I want to capture button clicks from within a list item row. Below I have tried to boil the problem down as much as I can. First, here is the xaml <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="test2.MainWindow" x:Name="Window" Title="MainWindow">  <Grid x:Name="LayoutRoot">  <ListView Margin="148,74,0,202" HorizontalAlignment="Left" ItemsSource="{Binding ListData}">   <ListView.View>    <GridView>     <GridViewColumn Header="Item" DisplayMemberBinding="{Binding ItemName}" />     <GridViewColumn Header="Options" Width="200" >      <GridViewColumn.CellTemplate>       <DataTemplate>        <StackPanel Orientation="Horizontal">         <Button Content="Reject" Height="20" Width="80" Margin="5,2" Command="{Binding Commands}" CommandParameter="RejectItem" /> 

Using UserName to enable disable access to InfoPath form fields

Hi Everyone, I have created a browser enable form in InfoPath and restrict certain fields depending on the official logged on User Name. Now this works most of the time but my problem has to do with the "case" of User Names for some of the site users. In most cases the User Name is an exact match but for some reason, some user's names are reported by SharePoint (the Welcome at top of screen) with some parts captilized. Example - my hidden filed on the form reports my user name as xrs_master but the Welcome up top says XRS_Master - and the fields act as though I am not the correct user and won't enable. On the other hand there are users who's user name matches the case exactly and all works fine. Why is SharePoint reporting the user name differently? And if this is the reason they don't match, how do I fix it? Any Ideas? Many thanks in advance for help!

Is there a way to conditionally enable/disable a custom action

I've created a custom action that kicks off a workflow on an item in a list.  I want the workflow to be initiated only once.  So, once it is kicked off the first time, I'd like the custom action to be disabled so others cannot start it again. Is there a way to do this in Sharepoint Designer?

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.

HDI : Enable and Disable checkboxes inside of DataGrid Template

I am again trying stuff that is a challenge.What i need to do is to enable and disable checkboxes in the gridI enable/disable them when i bind in grdDocApprovals_ItemDataBoundusing the following syntax( (CheckBox)e.Item.FindControl("chkReceived" )).Enabled = true;( (CheckBox)e.Item.FindControl("chkApproved" )).Enabled = false;That works wonderful. It disables the checkbox and i can not tick it.Now the problem comes in when i Tick the chkReceived box then i executemy javascript that finds the chkApproved box and is suppose to enable it.I noticed that in the HTML code during runtime there is a span and a td thatsurrounds the chkApproved. The <span>have a disabled = 'disabled' tag.and no matter what i do i can not get the chkApproved to be enabled. <span disabled="disabled"><input id="_ctl0_ContentMain_grdDocApprovals__ctl3_chkApproved" type="checkbox" name="_ctl0:ContentMain:grdDocApprovals:_ctl3:chkApproved" disabled="disabled" onclick="javascript:return response(this);" /></span>what can i do to get it active?

Issue with Enable and Disable Parameters in SSRS 2005

Hi Guys, I am currently facing an issue with Enabling and Disabling Parameters in SSRS 2005. Here is my scenario. I am having the following 4 parameters - ParamType (has values 1,2,3), ParamMonth, ParamStartDate, ParamEndDate Now What I want is When I select ParamType = 1 and 2 then ParamMonth should be enabled and ParamStartDate and ParamEndDate should be disabled. When I select ParamType = 3 then ParamStartDate and ParamEndDate should be enabled and ParamMonth should be disabled. I have done google search on this issue and found out that this is not possible at run time. Is there any alternative for this issue? If the above is not possible, I would like to get atleast in this way : When I select ParamType = 1 and 2 then ParamMonth should show the values (from dataset named MonthDataSet and default should be the latest Month) and ParamStartDate and ParamEndDate should show as NULL. When I select ParamType = 3, then I need to enter ParamStartDate and ParamEndDate values manually or pick via datepicker and ParamMOnth should show as NULL. I am not sure whether this is possible or not....but just trying to get in some way. Here is the query used in MonthDataSet : Select Month_Code, Month_Name from MonthTable. Thanks

Enable/disable show Quick launch toolbar option programatically

Hi all, Is there a way to enable/Diable(check or uncheck) show Quick launch toolbar option programatically. I am working in both winXP and windows 7. Regards Goutham

Enable/Disable controls dynamically based on User settings

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.  

Radio Button Enable Disable Multiple Panel


using c# asp.net i m able to achieve the enable and disable through auto postback

but i want this thing to achieve by javascript can anyone help me

Default Page

protected void Button1_Click(object sender, EventArgs e)
        string url = "default2.aspx?";
        url += "sid=" + Server.UrlEncode(DropDownList1.SelectedItem.Text.Trim());

Default 2

protected void Page_Load(object sender, EventArgs e)
        Panel1.Visible = false;
        Panel2.Visible = false;
        Panel3.Visible = false;
        Panel4.Visible = false;
        if (!IsPostBack)
            if (Request.QueryString != null)
                Label1.Text = Request.QueryString["sid"].ToString();

    protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
        if (Request.QueryString["sid"] == "new")
            Panel1.Visible = true;
            Panel2.Visible = false;
        if (Request.QueryString["sid"] == "old")
            Panel3.Visible = true;
            Panel4.Visible = false;
    protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
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