create a subsite from top level site collection​:

      YOU CAN CREATE A SUBSITE FROM TOP LEVEL SITE COLLECTION BY USING POWER SHELL COMMENDS.


Step 1:

   Get the top level site collection: 

     Open sharepoint power shell. and type the following commend

Export :  stsadm -o export -url <fullurl which u want to export> -filename <location:filename.dat

Step 2:

    Import as a sub site of another top level site

     Open sharepoint power shell. and type the following commend

Import : stsadm -o import -url <destination url> -filename <location where u stored.dat file>

Step 3:

       That's it,the site will imported as a subsite. But you have to check all the webparts are correctly deployed, and you have to manually give the site user permissions.

Remove the Quick Launch in SharePoint 2013

REMOVE THE QUICK LAUNCH IN SHAREPOINT 2013

You can remove this Quick launch bar in two ways.

Way 1 :
   You can open sharepoint designer and uncheck the option to "Display Quick Launch".But in this option there will be a empty space in left side,So its not look good

Way 2 :
  Option two is add a Script Editor webpart and use the following css to the Script Editor,you can place the web part anywhere in the page.Do the following

  • Edit the page
  • Add a web part.  Select Script Editor from the Media and Content Category
  • Choose Edit Snippet
  • Paste in the CSS 

CSS :


<style type="text/css">

#sideNavBox {
display: none;
}
#contentBox {
margin-left: 0px;
}
</style>

Screenshots : 




The remote session was disconnected because there are no Remote Desktop License Servers available to provide a license.

THE REMOTE SESSION WAS DISCONNECTED BECAUSE THERE ARE NO REMOTE DESKTOP LICENSE SERVERS AVAILABLE TO PROVIDE A LICENSE.

 

                          You  my see this kind of errors while you are connection your desktop connection.
 Then you have to do the following steps.

Step 1:

     
     click start->administrative tools->hit enter

Step 2:

      click Remote Desktop Services



Step 3:

     
     Click Remote Desktop Session Host Configuration

  

Step 4:    (In this following steps it may display some warning messages.dont worry about it,and do the following steps)

    In that remote desktop session host configuration->check the  Licensing  part. shown below. 

    In that the above 2 things where not specified  in your server.
 

Step 5:


     click first option remote desktop licensing mode-> and select option as per your need. 

 

Step 6:

      Then select any one of the listed system license( if there is no other license then just type the ip address of the sever ) 
->and click add->finally click ok..

 

Step 7:


     and click apply & ok on the property window


 Thats it. Now you can connect it.
It may show some error message or warning mesage. Dont worry about that. It will works fine.

Reference :

see this microsoft link

"The remote session was disconnected because there are no Remote Desktop client access licenses available for this computer. Please contact the server administrator."

"The remote session was disconnected because there are no Remote Desktop client access licenses available for this computer. Please contact the server administrator."

                       when  you are trying to connect your remote system you may get this  error.


To solve this do the following steps

Step 1:


     start->run->and type regedit->hit enter


Step 2:


     In that regeditor, click HKEY_LOCAL_MACHINE->SOFTWARE





Step 3:


     click SOFETWARE->MICROSOFT->MSLISENCING (delete this folder)

Step 4:


     Now goto start->Remote desktop connection->rightclick and run as a administrator(for 1st time only)->give administrator username & password


That's it. Now you can connected. and the deleted folder also automatically created in the registry.

how to change datagridview header color using blender

How to change datagridview header color using blender:

   Here we will see how to change datagrid header background color using blender.

Step-1:

    Open your project  with expression blend, and double click on your page.


 step-2:

     Right click on your datagrid->Edit addtional template->edit column header style->edit a copy(if u create first time then you have to give edit a copy)




 Step-3:

    Give apply to all(if you apply all column header and all data grids)->click ok



 Step-4:

    Right click on BackgroundGradient->and right side properties change the color(see below image)

Step-5:

   After changing the background color, If you want to change foreground color then, right click on data grid, and click view xml

Step-6:

   Inthat xml page scroll up for few lines, and there you will see the foreground option, there you can change the color





Step-7:

    Finally you have done it.

CALL A FUNCTION USING TIMER IN C#

CALL A FUNCTION USING TIMER IN C#

Hi,
      Here we are going to see how to call a particular function using c#. We can do that by using          DispatcherTimer class.Do the following steps.Here i explained using simple button click event.

Step1:

      Include namespace-> using System.Windows.Threading;


Step 2:

     Create a instance for the DispatcherTimer class, at where you want to call the function.Here i created and  call with in a button click event.

        DispatcherTimer timer= new System.Windows.Threading.DispatcherTimer();
            timer.Tick += delegate(object s, EventArgs args)
            {
               //write code here for what should call after 1 sec

              //after that don't forget to call the method(where you want to stop the timer)-> timer.Stop();
            };             
                          
            timer.Interval = new TimeSpan(0, 0, 1); // one second , you can change the time here
            timer.Start(); // here the timer will be started


thats it, your code will be called based on your timer 


See the example:

   I did this using silverlight.And here i am going to change background color the page dynamically.I change it by button click events. Here i created 2 buttons 


and initialize 2 variables    int start=0,stop=0;


In start button clicking i wrote some events like changing background color,and i start the timer.



In stop button click event im incrementing the stop variable value. and the above if condition will executed. then the timer will be stopped.

and run the program. and click the start button. the colors will be automatically change every 1 sec.

and when you click the stop button, the color change will be automatically stopped.
For Refrence  check this msdn link  

CREATE A SIMPLE NUMBERS LOADING ANIMATION USING C# IN SILVERLIGHT:

CREATE A SIMPLE NUMBERS LOADING ANIMATION USING C# IN SILVERLIGHT:

       Hi,  Here i am  explain how to create a simple  numbers loading animation.
And here the number will be loaded from '0' to '100'

Step 1:

     
     Create a button(name btnnumber) and label(name lblnumber)

Step 2:


     Here we are going to do that by  DispatcherTimer class. It is from the following name space
      using System.Windows.Threading; 

What is dispatch timer? How to use that?

 

     DispatcherTimer is a class that is used to call a function in a particular  time interval. see the below example(we should use within any function)

        DispatcherTimer timer= new DispatcherTimer ();
            timer.Tick += delegate(object s, EventArgs args)
            {
               //write code here for what should call after 1 sec
              //after that don't forget to call the method(where you want to stop the timer)-> timer.Stop();
            };             
                          
            timer.Interval = new TimeSpan(0, 0, 1); // one second , you can change the time here
            timer.Start(); // here the timer will be started


 Step 3:


       Include thfollowing name space->      using System.Windows.Threading; 
and declare a variable->       int animat_number = 0; 
And with in the buttion click function write the DispatcherTimer class codes


Here this is the code with in the button click function.

    private void btnnumber_Click(object sender, RoutedEventArgs e)
        {
            DispatcherTimer timer = new DispatcherTimer();

            timer.Tick += delegate(object s, EventArgs args)
                {
                    lblnumber.Content = animat_number;
                    animat_number++;
                    if (animat_number > 100)
                    {
                        animat_number = 0;
                        timer.Stop();
                    }
                };

            timer.Interval = new TimeSpan(0, 0, Convert.ToInt32(0.25)); // 0.25 second
            timer.Start();
        } 

Step 4:

     Just hit f5, or run the program. click the button. and the numbers will be loaded from 0 to 100.

 Thank you for reading this.Kindly give your suggestions 

Reference: 

 see the following microsoft link

how to get month name from month number in c#

how to get month name from month number in c#:

step-1:
   use this name space
   using System.Globalization;

step-2:
  use the bleow code
  string month=CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1)

Here 1 is for january month.You can give numbers(1 to 12) as per your need.

how to get month number from month name in c#

how to get month number from month name in c#:

step-1:
    inclued this name space
using System.Globalization;

step-2:
    use this code
string no= Convert.ToString(DateTime.ParseExact("may""MMMM"CultureInfo.InvariantCulture).Month)

Here instead of "may" you can give your month name.

how to convert a string into datetime in c#

How to convert a string into datetime in c#

step-1:

   First include this namespace
   using System.Globalization;

Step-2:

    Use the following code.

DateTime datetime = DateTime.ParseExact("01-may-1990""dd-MMMM-yyyy"CultureInfo.InvariantCulture,DateTimeStyles.None);            

how to get string between two strings in c#

how to get string between two strings in c#

Example:

    string source="one two three four five"

   If you want to get strins between "one" and "five" then use this function call

   string temp = GetStringBetween("one ""five", source);

And the copy the following function & paste in your program.

 public static string GetStringBetween(string strbegin, string strend, string source)
        {
            int iIndexOfBegin = source.IndexOf(strbegin) + strbegin.Length;
            string s1 = source.Substring(iIndexOfBegin);
            int iIndexOFfEnd = s1.IndexOf(strend);
            string s2 = s1.Substring(0, iIndexOFfEnd);
            return s2;
        }

Output:

"two three four"

count number of occurrences in string c#

count number of occurrences in string c# 

 First use the following namesapce
          using System.Text.RegularExpressions; 

  Use the following Regx code to count 
           string source="one two three one two one" 
           int count = Regex.Matches(source, "\\b(" + Yourstring + ")\\b").Count;
  that "\\b(" is used for eliminate specal charcter.

programatically highlight words using c#:

programatically highlight words using c#:

       Your output like this....

xaml:

    create a text block with name of tb.

 <TextBlock Height="autoTextWrapping="Wrap"  Width="200HorizontalAlignment="LeftMargin="45,12,0,0"Name="tbText="Textblock"  VerticalAlignment="Top" />

c# code:

         string source = "This is a example of Highlight a word using c#";   //Your source
        string[] highlight_words = { "example", "word" };                          //Your Key word

On your button click event call this function like this

         private void button1_Click(object sender, RoutedEventArgs e)
          {
            highilight(source);
           }

And copy paster this Function:

     public void highilight(string source)
        {
            int min = 0, chk = 0, chk2 = 0, tmp = 0;
            string negword = string.Empty; ;
            do
            {
                chk2 = 0;
                for (int j = 0; j < highlight_words.Count(); j++)     //find first negative keyword in source
                {
                    tmp = source.IndexOf(highlight_words[j]);
                    if (chk == 0 && tmp != -1)
                    { min = tmp; negword = highlight_words[j]; chk++; }
                    if (tmp < min && tmp != -1)
                    { min = tmp; negword = highlight_words[j]; }
                }

                var regex = new Regex(negword);
                var str = regex.Replace(source, "|", 1);          //replaces the first occurence
                var [] words = str.Split('|');

                tb.Inlines.Add(new Run() { Text = words[0], FontSize = 12, });         //split add it in a text block
                tb.Inlines.Add(new Run() { Text = negword, FontSize = 12, FontWeight = FontWeights.Bold, Foreground = new SolidColorBrush(Colors.Orange) });
                source = words[1];
                tmp = 0; min = 0; chk = 0;


                for (int k = 0; k < highlight_words.Length; k++)     //check the negative keword is present or not
                {
                    if (source.IndexOf(highlight_words[k]) != -1)
                    { chk2++; }
                }

                if (chk2 == 0)
                { tb.Inlines.Add(new Run() { Text = source, FontSize = 12 }); }    //add the last part of substring

            } while (chk2 > 0);
        }

messagebox result c#

MESSAGEBOX RESULT C#

C# code:

MessageBoxResult result = MessageBox.Show("your message! ", "MessageBox heading",MessageBoxButton.OKCancel);

  if (result == MessageBoxResult.OK)
 {
   //Your Code 
 }

how to retrieve data from active directory using c#

how to retrieve data from active directory using c#:


step 1:
First include this namespace  using System.DirectoryServices;

step 2:
And in page load function use the following code
(Use your active directory domain name,username,password in the following code)

 protected void Page_Load(object sender, EventArgs e)
        {
            string domainname = "mydomain"string username = "admin"string password = "1234";

            DirectoryEntry entry = new DirectoryEntry("LDAP://" + domainname, username, password,   AuthenticationTypes.Secure);
            DirectorySearcher search = new DirectorySearcher(entry);
            search.Filter = "(SAMAccountName=" + username + ")"//This is your login name(it filter based on 
                                                                                                                            //your login user name)
            SearchResult results = search.FindOne();
            if (results != null)
            {
                try
                {
                    lbldisplayname.Text = results.Properties["displayName"][0].ToString(); //htis is your full name
                    lblemail.Text = results.Properties["mail"][0].ToString();   //this is your mail address
                }
                catch (Exception ex)
                {
                    lblerr.Text = ex.ToString();
                }
            }
        }


pls refer this link for any doubts  http://www.willasrari.com/blog/query-active-directory-users-using-c/000133.aspx

Hide SpRibbon sharepoint 2010 for different user permissions

                Some times you may want to hide the SharePoint ribbon for some users who is having lower permissions.For that You need to do some modifications on master page.See the following steps
 We can  hide it from everyone except the users who have Full Control.

Step 1:


  • Open your master page and find <div id="s4-ribbonrow" tag
  • Then you need to add a new tag, which will hold the above tag.See the following code
<SharePoint:SPSecurityTrimmedControl PermissionsString="ManagePermissions" runat="server">
<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle">
   <!-- Ribbon code appears here... -->
 </div>
</SharePoint:SPSecurityTrimmedControl>


  • Here PermissionsString="ManagePermissions" is a permission level which you need to add in SharePoint site and then give the permission levels to groups
  • So people who are all having this ManagePermissions can view the Ribbon.

Step 2:

To add this permission level
 Just go to site settings-->site permission -->click on "permission level"-->click add permission level-->now select manage permission. Now you can assign same permission to your user or group.

Then finally save your master page and do check in and check out. That's it you have done!Now the people who have ManagePermissions can view the Ribbon

Note:
This SPSecurityTrimmedControl will not work for Full control(ie. full control users can view the Top ribbon even they dont have ManagePermissions )
If you want to make the Ribbon only visible to the Full control users then add PermissionsString="FullMask"

For more details see the following
Link1 ,
Link2
Link3
See this link for wsp solution file for this problem