Friday, March 27, 2009

ASP.NET and C# interview questions top links

http://blogs.crsw.com/mark/articles/254.aspx
http://www.coolinterview.com/type.asp?iType=42
http://www.dotnetuncle.com/Aspnet/aspnet_questions.aspx
http://www.thinkinterview.com/interview-questions/t1/asp-net-controls.aspx
http://www.dotnetquestion.info/dot_net/asp_net.php

CAML QUERY for sharepoint

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
namespace CamlQuery
{
class CamlQuery
{
static void Main(string[] args)
{
"string StrQuery ="";
SPSite site = new SPSite(“site”);
SPWeb testWeb = site.AllWebs[“web”];
SPList bdcList = testWeb.Lists[“list”];
SPQuery query = new SPQuery();
query.Query = StrQuery;
SPListItemCollection filteredItems =
bdcList.GetItems(query);
Console.WriteLine(“ available items”,
filteredItems.Count);
foreach (SPListItem item in filteredItems)
{
Console.WriteLine(“Found Order:”,
item[“Order”],
item[“Order: OrderName”]);
}

}
}
}

-Bharath

Add a GridView to a sharepoint webpart

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;


namespace samplewebpart
{
public class GridControl : WebPart
{
protected override void CreateChildControls()
{

GridView grdview = new GridView();
SPWeb web = SPContext.Current.Web;
SPList list = web.Lists["mylist"];
grdview.DataSource = list.Items.GetDataTable();
grdview.DataBind();
this.Controls.Add(grdview);


}
}
}

-Bharath Boddu

Sharepoint List

Creating Sharepoint List using object model

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;

SPWeb mySite = SPContext.Current.Web;
SPListCollection lists = mySite.Lists;

string listTitle = "List Title";
string listDescription = "Lst Description";
string listType = "Announcements";

SPListTemplateType listTemplateType = new SPListTemplateType();

listTemplateType = SPListTemplateType.Announcements;
lists.Add(listTitle, listDescription, listTemplateType);

Delete Sharepoint List

SPWeb mySite = SPContext.Current.Web;
SPListCollection lists = mySite.Lists;

SPList list = lists["ListName"];
System.Guid listGuid = list.ID;

lists.Delete(listGuid);

Update Sharepoint List

SPWeb mySite = SPContext.Current.Web;
SPListItemCollection listItems = mySite.Lists["ListName"].Items;

SPListItem item = listItems.Add();

item["Title"] = "List Title";
item["First Name"] = "FirstName";
item["Last Name"] = "Last Name";
item["Address"] = "Address";

item.Update();
}



-Bharath Boddu

Saturday, March 14, 2009

Top Links on Sharepoint

http://www.sheltonblog.com/
This Blog contains videos,tutorials and lot of useful information on Sharepoint.

http://technet.microsoft.com/en-us/windowsserver/sharepoint/bb407286.aspx. It provides the information about how to deploy the custom templates within the organization.

http://www.codeguru.com/csharp/.net/net_asp/webforms/article.php/c12293/
This site contains information on webpart creation.

-Bharath Boddu