How to Expand and Collapse asp TreeView Using Button

How to Expand and Collapse asp TreeView Using Button
I want to Expand and Collapse Asp TreeView control using button, In page load i expand all nodes. button will show "hide". While clicking hide it will show "Show" all nodes will Collapse.

In Ascx page:

        <asp:Button runat="server" ID="btnhide" OnClick="btnhide_onclick" Text="Hide" />
        <asp:TreeView ID="TreeViewID" runat="server">                            
        </asp:TreeView>
    
In Pageload:

 TreeViewID.ExpandAll();

Button OnClick

protected void btnhide_onclick(object sender, EventArgs e)
        {
            if (btnhide.Text == "Hide")
            {
                TreeViewID.CollapseAll();
                btnhide.Text = "Show";               
            }
            else
            {
                if(btnhide.Text == "Show all")
                {
                    TreeViewID.ExpandAll();
                    btnhide.Text = "Hide all";
                }
            }           


        }

How to create Calculated field in list Schema

How to create Calculated field in list Schema
            I want to create Calculated field in list schema, Formula SP"&(TEXT([Created],”yyyy”)) the following code help you to create this formula in Schema

"SP"& (TEXT([Created],”yy”))  
"SP"& (TEXT([Created],”yy”))  

 <Field Type="Calculated" ID="{CG453ACF-2131-4836-AGJ9-3EF894A57225}"        EnforceUniqueValues="FALSE" Indexed="FALSE" LCID="1033" ResultType="Text"  DisplayName="CalID" StaticName="CalID" Name="CalID" Required="FALSE" >
       <Formula>="SP"&amp;TEXT(Created,"yyyy")</Formula>
           <FieldRefs>
                <FieldRef Name="Created"/>
       </FieldRefs>
 </Field>

In Previous article we can check  How to create Calculated Fields in SharePoint List &  with some Date and Time Formulas.

The user's password must be changed before logging on the first time

the user's password must be changed before logging on the first time


when we created a new user in start->allprograms-> computer management->Users->Right click Creating a new user by default Check box is checed with User must change password at newlogin
as shown in below figure



un check the check box and select password never expires and click create 





Now error will gone...

how to deploy wsp in sharepoint 2013 using powershell

how to deploy wsp in sharepoint 2013 using powershell
how to deploy wsp in sharepoint 2013 using powershell

I kept the wsp file in my Desktop.

Now i opened the SharePoint Powershell run this script.
Add-SPSolution "C:\Users\DotNetSharePoint\Desktop\WSPName.wsp"
Adding wsp to solution Management
once we run this command on powershell we can see the wsp file in Central Admin->System Settings->Manage Form Solutions.
we can see the deployed WSP.

Deploy the Wsp to Particular web application

Install-SPSolution –Identity WSPName –WebApplication http://Test:1234/ –GACDeployment

Active the Feature

Enable-SPFeature –Identity FeatureName –url http://Test:1234/sites/Home
Deactive the Feature

Disable-SPFeature –Identity FeatureName –url http://Test:1234/sites/Home
Uninstall the Feaure

Uninstall-SPFeature FeatureName

Get attachments in SharePoint custom list Programatically

Get attachments in SharePoint custom list Programatically

I want to get Attachments based on SPQuery, the following code will help you to get the attachments.

               SPLIobjItems = Customlist.GetItems(spqueryobj);

                 foreach (SPListItem SPLIobj in SPLIobjItems )
                      {                          
                            foreach (String attachmentname in SPLIobj .Attachments)
                             {             
                               //Based on SPLIobj getting attachments
                                String attachmentURL = SPLIobj .Attachments.UrlPrefix + attachmentname;
                                
                                 attchedvalue = attachmentURL ;
                             }
                        }

Get url and take last value of url using jquery

 Get url and take last value of url using jquery
Get current url on PageLoad and assign that value to asp.net textbox control.

Ex: I get this url using the following script, in that url i want to get url of the last value and the name lakshmi.
http://www.dotnetsharepoint.com/2014/01/cannnot-connect-to-performance-point/lakshmi.aspx

<asp:TextBox ID="txt_name" runat="server"></asp:TextBox>

Script:

$(document).ready(function () {
       var currenturl = $(location).attr('href');
       //alert(currenturl );    //In currenturl  i am getting current url
       var pagename = jloc.substr(jloc.lastIndexOf('/') + 1);
       //alert(pagename);    // In pagename i am getting "lakshmi.aspx"
       var name = pagename.split('.')[0];  //In name am getting the "lakshmi"
       //alert(name);
       var fname = $("#<%=txt_txtname.ClientID%>").val(name);  //assign value to asp textbox
       $("#mytext").val(name); //html id type



Cannot connect to performance point services contact the administrator for details

When I am trying to create new data source in the dashboard designer I am getting this issue

 



 

Navigate to Application Management ->Service applications->Configure Service application associations->Click on Default



 

Check the PerformancePoint Service Application Proxy Click Ok.
Now we can able to create new data source.

Cannot complete this action as the Secure Store Shared Service is not responding. Please contact your administrator



When I am configuring Performance Point Service in SharePoint 2013 I am facing this error

Cannot complete this action as the Secure Store Shared Service is not responding. Please contact your administrator.

Before we have to check

Go to System Settings->Manage Services on Server.

We have to enable the Following Services.

Performance Point Service

Secure Store Service

Claims Windows token Service.

Finally Reset the IIS.


Add SharePoint ListView in Page

Add SharePoint ListView in Page
We can easily add list view in .aspx Page , without adding UserControl and Visual WebPart pages.

Add the following code in .aspx page.

<asp:Content ID="Content1" ContentPlaceholderID="PlaceHolderPageTitle" runat="server">
   ListView
</asp:Content>

<asp:Content ID="Content2" ContentPlaceholderID="PlaceHolderMain" runat="server">
             <WebPartPages:WebPartZone ID="WPListview" runat="server" >
        <ZoneTemplate>
        </ZoneTemplate>
    </WebPartPages:WebPartZone>
</asp:Content>

In Elements Add the following code.

<File Path="Module1\ListView.aspx" Url="view.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
      <View BaseViewID="2" Type="HTML" List="Lists/Testlist" DisplayName="TestView" Name="TestView" DefaultView="TRUE" WebPartZoneID="WPListView" WebPartOrder="1" />
 </File>

How to create SharePoint List views in List Schema

How to create SharePoint List views in List Schema
      I have created custom view through list schema in VS 2012. While creating first time i cant able to get the custom view under the list settings view. I miss some fields. Using the following code i can able to see the view in under the list settings view.
 We can create the number of views based on "BaseViewID" , Default while creating list in Visual Studio BaseViewID="1". While creating more views BaseViewID must be 'Unique'.
Example:2,3,4...

<View Name="{7689D8A2-546E-4371-84B0-7656B654A6SW}" BaseViewID="2" Type="HTML" WebPartZoneID="Main" DisplayName="sp" MobileView="TRUE" Url="sp.aspx" ImageUrl="/_layouts/15/images/generic.png" SetupPath="pages\viewpage.aspx" DefaultView="FALSE" TabularView="FALSE" ModerationType="Moderator"  >
        <Toolbar Type="Standard" />
        <XslLink Default="TRUE">main.xsl</XslLink>
        <JSLink>clienttemplates.js</JSLink>
        <RowLimit Paged="TRUE">30</RowLimit>
        <ViewFields>
          <FieldRef Name="Name"/>
          <FieldRef Name="Adress"/>
        </ViewFields>
        <Query>
          <OrderBy>
            <FieldRef Name="ID">
            </FieldRef>
          </OrderBy>
        </Query>
        <ParameterBindings>
          <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
          <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
        </ParameterBindings>

      </View>