Skip to main content

Posts

Default Databases Created in SQL Server After Sharepoint 2010 Installation

These are the databases that are created after sharepoint 2010 installation.

Content Query WebPart (CQWP) in SharePoint 2010

The Content Query Web Part is a tool that site designers can use to aggregate interesting and relevant slices of information on web page by letting you build queries through an easy to use UI and then display that content in unique, configurable ways. The CQWP is designed to return roll-up content over several different scopes, anywhere from a single a list or library, to all lists or libraries across an entire Site Collection.  In SharePoint 2010, the CQWP single list query is also optimized to work over large single libraries, taking advantage of smart indices and other tools designed to improve query performance over large document libraries. Content Query WebPart comes first in MOSS 2007, but in SharePoint 2010 there are some new features introduced.Content Query Web Part (CQWP) is used to show information from sites in the current site collection by querying, filtering, and sorting the content. Also CQWP you can show information from list as well as from publishi...

Passing value from popup window to parent form's TextBox Using JavaScript

Passing values from a popup window back to the parent page is an often asked question. Especially when there is a GridView type control in the popup. In the following example we will be using two forms. The parent form will be parent.aspx and the popup will be popup.aspx. Also note that the parent.aspx form is derived from some MasterPage. Code is provided both in VB.Net and C#.Net. --- .aspx of parent form --- <script type="text/javascript"> function OpenPopup() {     window.open("popup.aspx","List","scrollbars=no,resizable=no,width=400,height=280");     return false; } </script> .       . .       <asp:TextBox ID="txtPopupValue" runat="server" Width="327px"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Show List" /> --- .vb of parent.aspx if vb.net is the language --- If Not IsPostBack Then     Me.Butt...

To Prevent Browser BACK button click after SignOut Using JavaScript

There are so many threads open related to this issue. After sign out when the user press BACK button on the browser, it gets him to the members page. Logicaly, it's done on the client side and we cannot do much from the code-behind. So, in order to prevent Browser BACK button click after SignOut, we have to use some javascript. The first and easiest approach to acomplish this is by using the following javascript code: <body onload="javascript:window.history.forward(1);">  This code should be placed on the <body> tag of the Members page where Log out button appears. The problem is that this code will work perfectly on IE (Internet Explorer) but won't work at all for Mozilla Firefox 3.x versions. So, in order to make this work on Mozilla Firefox, I've prepared Javascript function which is: <script type="text/javascript" language="javascript">   function disableBackButton() { window.history.forward() }  d...

Dispaly the time on Webpage using Java Script

JavaScript sample to continuously display the current time on the web page. Continuously means that the textbox value will be updated with the current time every second. <script type="text/javascript">     function ShowTime() {         var dt = new Date();         document.getElementById("<%= TextBox1.ClientID %>").value = dt.toLocaleTimeString();         window.setTimeout("ShowTime()", 1000);     }   </script>  <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  <script type="text/javascript">     // a startup script to put everything in motion     window.setTimeout("ShowTime()", 1000); </script> If you are using normal web form then it can also be called on Body onload event. If you are using MasterPage then it can be called within...

Select and Deselect All check boxes in a Grid Using JavaScript

Call the below function in the onclick event of the header check box. function  SelectDeselect(headerCheckBox) { //Get grid view object using grid view id. var  gridViewControl = document.getElementById( '<%=GridView1.ClientID %>' ); //Get all input tags from the grid view(i.e table). var  inputTagsFromGrid = gridViewControl.getElementsByTagName( "input" ); //Loop through each input tag and check the type and select or deselect the input field. for  (index = 0; index < inputTagsFromGrid.length; index++) { //Checking the type as check box or not. if  (inputTagsFromGrid[index].type ==  'checkbox' ) { //This will be selected or deselected based on the header checkbox selection. inputTagsFromGrid[index].checked = headerCheckBox.checked; } } }

Enabling anonymous access in SharePoint 2007

Even though Microsoft has done a great job on improving the user interface in SharePoint 2007, some things are still buried and require a little “black magic” to get done. In this entry I’ll show you how to enable anonymous access on your site. First, you need to enable anonymous on the IIS web site (called a Web Application in SharePoint land). This can be done by: •Launching Internet Information Services Manager from the Start -> Administration Tools menu •Select the web site, right click and select Properties •Click on the Directory Security tab •Click on Edit in the Authentication and access control section Instead we’ll do it SharePoint style using the Central Administration section: •First get to your portal. Then under “My Links” look for “Central Administration” and select it. •In the Central Administration site select “Application Management” either in the Quick Launch or across the top tabs •Select “Authentication Providers” in the “Application Security” section...

Set Focus Controls - AutoPostBack = true Using Java Script

Every time user’s complaints me about page scroll issues.  For example: If a lengthy page having a dropdown list with AutoPostBack = true at bottom of page. After the selection page gets reloaded and focus will be on top of the page. User needs to again scroll down the page for next key in. Here a sample solution for help...  c# public void SetFocus(Page sPage)     {         string[] sCtrl = null;         string sCtrlId = null;         Control sCtrlFound = default(Control);         string sCtrlClientId = null;         string sScript = null;         sCtrl = sPage.Request.Form.GetValues("__EVENTTARGET");         if ((sCtrl != null))         {      ...

Redirect to a new page, when we get 404.htm error page in the application

Create a custom Page Not Found is to create a site level feature receiver that will attach it to the webApplication instance. On the activated event you would attach it like this:     [SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]     public override void FeatureActivated(SPFeatureReceiverProperties properties)     {       if (properties != null)       {         try         {           SPSite site = properties.Feature.Parent as SPSite;           System.Uri webApplicationUri = new Uri(site.Url);           SPWebApplication webApplication = SPWebApplication.Lookup(webApplicationUri);           if (webApplication != null) ...

Sharepoint Programming Part7

Q) Retrieving information from linked lists in SharePoint using LINQ to SharePoint? using System.Linq; using Microsoft.SharePoint; using Microsoft.SharePoint.Linq; In the Page_Load method, add the following code: DataContext dc = new DataContext(SPContext.Current.Web.Url); var customers = dc.GetList < Customer > (“Customers”); var customerDataSource = from customer in customers select new {CustomerName = customer.Title, ContactLastName = customer.PrimaryContact.Title, ContactFirstName = customer.PrimaryContact. FirstName}; CustomerGridView.DataSource = customerDataSource; CustomerGridView.DataBind() Q) How you can retrieve the name of each folder in the top - level site of a site collection, as well as the number of subfolders that each folder contains? using System; using System.Text; using Microsoft.SharePoint; namespace Wrox.SixInOne { class Program { static void Main(string[] args) { StringBuilder folderName = new StringBuilder(); ...