SYNTAX HIGHLIGHTER

Saturday, September 13, 2014

c# - Write values in app.config

Introduction

We all have used app.config appsettings in our applications. when try to add or edit appsettings in run time it will only persist state for current user session.  if restart the app the saved appsetting will have lost.in this post I am trying to resolve the problem.

Main View


Save appSetting in runtime

if this code block save appSetting that will not reflect to current user session. to change current session value you need to add next image's code



Update current user session


Complete code block



Download code sample Click here

I most welcome your comments

WPF DataGrid Row Select with MVVM + Prism 5

Introduction 

I have already published how to select Data grid row with MVVM. this article I am going to introduce Prism 5 data grid select.  you see my previous post in here


Main view




how to get new prism 5


View Model
 CustomerViewModel class has been derived in "BindableBase" this a new prism 5 class which implement INotifyProperyChanged. you can see new lambda expression for property change and set value with SetProperty Method
View

Download code sample Click here

I will most welcome your comments

Monday, March 11, 2013

WPF DataGrid Row Select with MVVM


Introduction

In this article I am going to discuss how to select Row in the DataGrid control with MVVM pattern. Basically, MVVM pattern directly engage with WPF/Silverlight using Command binding. Command binding is a power full feature in the WPF/Silverlight. you can find new version of this here

Prerequisites
In this sample, I am using Visual studio 2010 and .net framework 4.0

Solution
1.      1.  I am creating a WPF project Called “SolutionFileManager” and Add  3 folders called “Models,              ViewModels and Views” 


2         2.  Add new class called “DataFile” into Models .  This is our Domain Entity and that contains few properties

            3.       Add new “ViewModel “ called “DataFileListViewModel”.  DataFileListViewModel responsible for handing Command which are fired in the views and make data for the relevant view

       4.        Add new class for ICommand Implementation called “DelegateCommand”
          
5.      Add NuGet package Reference
a.       Right click on project and select “Manage NuGet Packages…”
b.      Type “expression blend” in the search box
c.       Select “Blend Interactivity for WPF v4.0” and click install


              d.  Nuget package manager add Reference for “Microsoft.Expression.Interactions and System.Windows.Interactivity”

     6.     Add new userControl for Views folder called “DataFileList.xaml” and set it as startup window
      
             
             7.   Add Xaml markup for DataFileList.xaml. Below  Xaml add “PreviewMouseUP” event triger using interactivity


      8.    Add Viewmodel binding to code behind  file

        9.   Run the application and click on grid Row

              Download code sample Click here

Wednesday, December 19, 2012

How to remove SharePoint 2010 feature



when you developing custom solution on SharePoint 2010, you might get error with custom feature which you develop may be  not have control with central admin then you can use SharePoint Power shell command to remove (uninstall) SharePoint Feature.

To remove SharePoint feature.

Before remove, you should know feature GUID (ID). To get feature id  run the below command on SharePoint PowerShell window.

          Get-SPFeature



      Copy the id of the feature

Run the below command to remove feature from SharePoint 2010

Uninstall-SPFeature -Identity "0808a7d5-aeab-s-409d-a975-c882351a507b"


Press "Y" to continue process.


Monday, December 17, 2012

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'


Login failed for user 'NT AUTHORITY\ANONYMOUS  LOGON'

When you create Business Data Connectivity Services with SQL Server using SharePoint Designer, above error will come because of , External System not getting proper identity to connect. To resolve the problems relating BCS authentication consider below steps

How to change BCS Authentication Mode.

1.       Change the Authentication mode to BCS Identity



2.       If you get error, please update the BCS  “RevertToSelfAllowed”  to true using below Powershell command.


To list down SPservices Ids and then copy Business connectivity id
          Get-SPServiceApplication;



To get Business connectivity service

$bcs = Get-SPServiceApplication  -ID  ”<<Id>>”
$bcs. RevertToSelfAllowed  = $true
$bcs.Update();

Note: after update  you might need  reset IIS

3.       Although you update BCS credential  , it might show error message on the page like below


In my scenario ,I  saw below errors log the  in Event Viewer






To resolve the problem,

1.       Verify your site App pool account have sufficient credential in DB
2.       In SQL server , “User Mapping” data base for App pool account







3.       Verify relevant user “Schemas “ and  “Data base Role Membership”