| PlaceHolderPageTitle |
| PlaceHolderAdditionalPageHead |
| WSSDesignConsole |
| SPNavigation |
| PlaceHolderMain |
| PlaceHolderPageDescription |
| PlaceHolderPageImage |
| PlaceHolderTitleLeftBorder |
| PlaceHolderPageTitleInTitleArea |
| PlaceHolderMiniConsole |
| PlaceHolderTitleRightMargin |
| PlaceHolderTitleAreaSeparator |
| PlaceHolderLeftNavBarDataSource |
| PlaceHolderLeftActions |
| PlaceHolderNavSpacer |
| PlaceHolderLeftNavBarBorder |
| PlaceHolderBodyLeftBorder |
| PlaceHolderBodyRightMargin |
| PlaceHolderCalendarNavigator |
| PlaceHolderLeftNavBarTop |
| PlaceHolderLeftNavBar |
| PlaceHolderSiteName |
| PlaceHolderGlobalNavigationSiteMap |
| PlaceHolderGlobalNavigation |
| PlaceHolderTopNavBar |
| PlaceHolderHorizontalNav |
| PlaceHolderFormDigest |
| PlaceHolderUtilityContent |
| PlaceHolderBodyAreaClass |
| PlaceHolderTitleAreaClass |
Monday, February 13, 2012
Content Placeholder Names in SharePoint 2007 Custom Master Page
How to open SharePoint 2007 or SharePoint 2010 Document Library as a Network Place
- Login to your SharePoint site.
- Go to your respective Document Library.
- Now copy the URL (Leave Forms/AllItems.aspx and copy the remaining part).
- Now go to My Network Places in your computer/Laptop.
- Now click on Add Network Place.
- Now click next.
- In the Second step select Choose another Network Location and click on Next.
- Now type your Document Library Address and click next.
- Now it will prompt for credentials.
- Type your username and password.
- In the Next Step give your own name for your network place.
- In next step click on checkbox open this network place when I finish.
- Now click on finish.
- Now your document library will be seen like a network place folder.
Imp Note While Creating a Columns in SharePoint
Please do not create the column with Special Characters or Spaces. Please use caml query builder to get it's exact internal name if you had done so.
Thursday, February 09, 2012
Calling and Using Stored Procedures in Asp.Net Environment
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
txtusername.Focus();
}
SqlConnection con = new SqlConnection(@"Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=samplDB;Data Source=IRIDIUM102");
SqlCommand cmd = new SqlCommand();
protected void btnSubmit_Click(object sender, EventArgs e)
{
con.Open();
cmd.CommandText = "sp_insuserdet";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.Parameters.Add("@uname", SqlDbType.NVarChar, 50);
cmd.Parameters["@uname"].Value = txtusername.Text;
cmd.Parameters.Add("@pwd", SqlDbType.NVarChar, 50);
cmd.Parameters["@pwd"].Value = txtpassword.Text;
int t=cmd.ExecuteNonQuery();
try
{
if (t > 0)
Response.Write("Record Inserted");
else
Response.Write("Insertion failed");
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
con.Close();
clear();
}
private void clear()
{
cmd.Parameters.Clear();
txtusername.Text = "";
txtpassword.Text = "";
txtusername.Focus();
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
con.Open();
cmd.CommandText = "sp_upduserdet";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.Parameters.Add("@uname", SqlDbType.NVarChar, 50);
cmd.Parameters["@uname"].Value = txtusername.Text;
cmd.Parameters.Add("@pwd", SqlDbType.NVarChar, 50);
cmd.Parameters["@pwd"].Value = txtpassword.Text;
int t = cmd.ExecuteNonQuery();
try
{
if (t > 0)
Response.Write("Record updated");
else
Response.Write("updation failed");
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
con.Close();
clear();
}
protected void btnDelete_Click(object sender, EventArgs e)
{
con.Open();
cmd.CommandText = "sp_deluserdet";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.Parameters.Add("@uname", SqlDbType.NVarChar, 50);
cmd.Parameters["@uname"].Value = txtusername.Text;
cmd.Parameters.Add("@pwd", SqlDbType.NVarChar, 50);
cmd.Parameters["@pwd"].Value = txtpassword.Text;
int t = cmd.ExecuteNonQuery();
try
{
if (t > 0)
Response.Write("record deleted");
else
Response.Write("deletion failed");
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
con.Close();
clear();
}
protected void btnFind_Click(object sender, EventArgs e)
{
con.Open();
cmd.CommandText = "sp_finduserdet";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.Parameters.Add("@uname", SqlDbType.NVarChar, 50);
cmd.Parameters["@uname"].Value = txtusername.Text;
cmd.Parameters.Add("@pwd", SqlDbType.NVarChar, 50);
cmd.Parameters["@pwd"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
try{
txtpassword.Text = cmd.Parameters["@pwd"].Value.ToString();
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
con.Close();
}
}
Sql Server Stored Procedures Samples
| Stored Procedures Samples | |
| Procedure for delete | Create PROCEDURE sp_deluserdet(@uname nvarchar(50),@pwd nvarchar(50)) AS begin delete users where username=@uname and password=@pwd end |
| Procedure for Select | create PROCEDURE sp_finduserdet(@uname nvarchar(50),@pwd nvarchar(50) output) AS begin select @pwd=pwd from users where username=@uname end |
| Procedure for Update | creatte PROCEDURE sp_upduserdet(@uname nvarchar(50),@pwd nvarchar(50)) AS begin update users set password=@pwd where username=@uname end |
| Procedure for Insert | create PROCEDURE sp_insuserdet(@uname nvarchar(50),@pwd nvarchar(50)) AS begin insert into users values(@uname,@pwd) end |
How to use Image as a Bullet(LI) in HTML.
First Take the image from the designer. write ul and li tags. In li tags just give the below code in li style property.
<ul>
<li style="list-style-image:url('Image URL you are willing to keep as a Bullet');background-repeat:no-repeat;"> Test
</li>
</ul>
<ul>
<li style="list-style-image:url('Image URL you are willing to keep as a Bullet');background-repeat:no-repeat;"> Test
</li>
</ul>
Hooray SkyDrive
SkyDrive is the thing given by Microsoft which allows you to store data up to 25GB. Now all the pen drives are gone.
Tuesday, February 07, 2012
Where do we find WSP once Deployed in SharePoint Server 2007
Windows Directory:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES
How to make a WebPart as a WSP in Single Step using Visual Studio 2005
- Create a Project with Visual Studio 2005 within a SharePoint Server.
- Do all the things necessary within your WebPart.
- Now Build the WebPart and Right on Properties of the WebPart Project.
- Now in WebPart Project Go to Debug Tab.
- There you will have an radio button with the name Start Browser with URL.
- You can find a TextBox next to that.
- Type your SiteName in that TextBox and Build the WebPart.
- Now right click on WebPart Project and click on Deploy.
- Now these steps with generate you a WSP and WebPart will be automatically set to your site.
How to bind a Simple Dynamic HTML Table from SharePoint Links List
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
SPList lstRecipeeLinks = currentWeb.Lists["Recipees Links"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<OrderBy><FieldRef Name='URL' /></OrderBy>";
sQuery.ViewFields = "<FieldRef Name='URL' />";
SPListItemCollection recipeeColl = lstRecipeeLinks.GetItems(sQuery);
if (recipeeColl.Count > 0)
{
writer.Write("<Table width='100%' cellpadding='0' cellspacing='0' border='1' borderColorDark='blue'>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td style='font-size:x-small;font-weight:bold;' Align='Center' Colspan='2'>");
writer.Write("Indian Recipee Links");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
int k = 1;
foreach (SPListItem item in recipeeColl)
{
string strLinkUrl = string.Empty;
string strLinkDescription = string.Empty;
SPFieldUrlValue strUrlValue = new SPFieldUrlValue(item["URL"].ToString());
strLinkUrl = strUrlValue.Url;
strLinkDescription = strUrlValue.Description;
writer.Write("<Tr>");
writer.Write("<Td width='5'>");
writer.Write(k);
writer.Write("</Td>");
writer.Write("<Td>");
writer.Write("<a href='" + strLinkUrl + "' target='_blank' style='font-size:x-small;color:Navy;text-Decoration:None;'>" + strLinkDescription + "</a>");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
k++;
}
writer.Write("</Table>");
}
});
}
catch (Exception ex)
{
writer.Write(ex.ToString());
}
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
SPList lstRecipeeLinks = currentWeb.Lists["Recipees Links"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<OrderBy><FieldRef Name='URL' /></OrderBy>";
sQuery.ViewFields = "<FieldRef Name='URL' />";
SPListItemCollection recipeeColl = lstRecipeeLinks.GetItems(sQuery);
if (recipeeColl.Count > 0)
{
writer.Write("<Table width='100%' cellpadding='0' cellspacing='0' border='1' borderColorDark='blue'>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td style='font-size:x-small;font-weight:bold;' Align='Center' Colspan='2'>");
writer.Write("Indian Recipee Links");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
int k = 1;
foreach (SPListItem item in recipeeColl)
{
string strLinkUrl = string.Empty;
string strLinkDescription = string.Empty;
SPFieldUrlValue strUrlValue = new SPFieldUrlValue(item["URL"].ToString());
strLinkUrl = strUrlValue.Url;
strLinkDescription = strUrlValue.Description;
writer.Write("<Tr>");
writer.Write("<Td width='5'>");
writer.Write(k);
writer.Write("</Td>");
writer.Write("<Td>");
writer.Write("<a href='" + strLinkUrl + "' target='_blank' style='font-size:x-small;color:Navy;text-Decoration:None;'>" + strLinkDescription + "</a>");
writer.Write("</Td>");
writer.Write("</Tr>");
writer.Write("<Tr>");
writer.Write("<Td bgcolor='Blue' Colspan='2'>");
writer.Write("</Td>");
writer.Write("</Tr>");
k++;
}
writer.Write("</Table>");
}
});
}
catch (Exception ex)
{
writer.Write(ex.ToString());
}
Monday, February 06, 2012
How to hide Quick Launch within a SharePoint 2010 Master Page.
- Login into SharePoint Designer with Admin Permissions.
- Go to V4.Master Page
- In Head tag type the above Code
- <style type="Text/Css">.ms-quickLaunch{display:none;}</style>
How to hide Quick Launch within a SharePoint 2007 Master Page
- Login into SharePoint Designer with Admin Permissions.
- Go to Default.Master Page
- In Head tag type the above Code
- <style type="Text/Css">.Ms-NavFrame{display:none;}</style>
How to Make Links Open within a New Window in SharePoint Links List AllItems.Aspx Page
Place this script within your SharePoint Links List AllItems.aspx Page.
<script language="javascript" type="text/javascript">
function OpenLinkinNewWindow()
{
var anchors = document.getElementsByTagName("a");
for (var x=0; x<anchors.length; x++)
{
anchors[x].target="_blank";
}
}
_spBodyOnLoadFunctionNames.push("OpenLinkinNewWindow");
</script>
<script language="javascript" type="text/javascript">
function OpenLinkinNewWindow()
{
var anchors = document.getElementsByTagName("a");
for (var x=0; x<anchors.length; x++)
{
anchors[x].target="_blank";
}
}
_spBodyOnLoadFunctionNames.push("OpenLinkinNewWindow");
</script>
How to hide the Title Column within a SharePoint List
How to hide the Title Column within a SharePoint List. |
|
Sunday, February 05, 2012
How to Edit the WebPart Page If you are not having site actions menu in your Master Page
At the end of your page url give this statement ?PageView=Shared&DisplayMode=Design
For Example please see the below Sample.
http://vlnrm:100/UserPages/Repeater%20Sample.aspx?PageView=Shared&DisplayMode=Design
For Example please see the below Sample.
http://vlnrm:100/UserPages/Repeater%20Sample.aspx?PageView=Shared&DisplayMode=Design
Friday, February 03, 2012
Another way to write JavaScript Validaton for Server Controls in SharePoint
<script language="javascript" type="text/javascript">
function validateControls()
{
if (document.getElementById("<%=txtUserName.ClientID %>").value == "")
{
alert('UserName Required');
document.getElementById("<%=txtUserName.ClientID %>").focus();
return false;
}
if (document.getElementById("<%=txtPassWord.ClientID %>").value == "")
{
alert('PassWord Required');
document.getElementById("<%=txtPassWord.ClientID %>").focus();
return false;
}
return true;
}
</script>
In Page_Load of UserControl use the button properties in this way.
btnSave.Attributes.Add("OnClick", "return validateControls();");
function validateControls()
{
if (document.getElementById("<%=txtUserName.ClientID %>").value == "")
{
alert('UserName Required');
document.getElementById("<%=txtUserName.ClientID %>").focus();
return false;
}
if (document.getElementById("<%=txtPassWord.ClientID %>").value == "")
{
alert('PassWord Required');
document.getElementById("<%=txtPassWord.ClientID %>").focus();
return false;
}
return true;
}
</script>
In Page_Load of UserControl use the button properties in this way.
btnSave.Attributes.Add("OnClick", "return validateControls();");
Wednesday, February 01, 2012
How to Make Microsoft Asp.Net Chart Controls work in SharePoint 2010
First Copy the System.Web.DataVisualization dll to the bin folder of your respective sharepoint site. Now add below steps in web.config. This will get you a Microsoft Asp.Net Chart WebPart into your SharePoint 2010 site. Here is the reference link i had followed.
http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/29c02114-19a4-4f68-8043-dd1341634656
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;" />
</appSettings>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<system.webServer>
<handlers>
<add name="ChartImg" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
Also make sure that you've the following register directives
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/29c02114-19a4-4f68-8043-dd1341634656
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;" />
</appSettings>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<system.webServer>
<handlers>
<add name="ChartImg" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
Also make sure that you've the following register directives
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
Getting Data from SharePoint List to CheckBoxList and RadioButtonList and showing them in two columns side by side
OutPut:-
.Ascx File for CheckBoxList
<asp:CheckBoxList ID="chkArticles" runat="server" RepeatDirection="Horizontal" DataValueField="Title" DataTextField="Title" RepeatColumns="2"></asp:CheckBoxList>
Code to Bind Data for CheckBoxList in .Ascx.cs file
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
SPList lstArticles = currentWeb.Lists["Articles"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<OrderBy><FieldRef Name='Title' Ascending='True' /></OrderBy>";
sQuery.ViewFields = "<FieldRef Name='Title' />";
sQuery.ViewFieldsOnly = true;
SPListItemCollection myColl = lstArticles.GetItems(sQuery);
if (myColl.Count > 0)
{
chkArticles.DataSource = myColl.GetDataTable();
chkArticles.DataBind();
}
});
.Ascx file for RadioButtonList
<asp:RadioButtonList ID="rblArticles" runat="server" RepeatDirection="Horizontal" DataValueField="Title" DataTextField="Title" RepeatColumns="2"></asp:RadioButtonList>
Code to Bind Data for RadioButtonList in .Ascx.cs file
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
SPList lstArticles = currentWeb.Lists["Articles"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<OrderBy><FieldRef Name='Title' Ascending='True' /></OrderBy>";
sQuery.ViewFields = "<FieldRef Name='Title' />";
sQuery.ViewFieldsOnly = true;
SPListItemCollection myColl = lstArticles.GetItems(sQuery);
if (myColl.Count > 0)
{
rblArticles.DataSource = myColl.GetDataTable();
rblArticles.DataBind();
}
});
.Ascx File for CheckBoxList
<asp:CheckBoxList ID="chkArticles" runat="server" RepeatDirection="Horizontal" DataValueField="Title" DataTextField="Title" RepeatColumns="2"></asp:CheckBoxList>
Code to Bind Data for CheckBoxList in .Ascx.cs file
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
SPList lstArticles = currentWeb.Lists["Articles"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<OrderBy><FieldRef Name='Title' Ascending='True' /></OrderBy>";
sQuery.ViewFields = "<FieldRef Name='Title' />";
sQuery.ViewFieldsOnly = true;
SPListItemCollection myColl = lstArticles.GetItems(sQuery);
if (myColl.Count > 0)
{
chkArticles.DataSource = myColl.GetDataTable();
chkArticles.DataBind();
}
});
.Ascx file for RadioButtonList
<asp:RadioButtonList ID="rblArticles" runat="server" RepeatDirection="Horizontal" DataValueField="Title" DataTextField="Title" RepeatColumns="2"></asp:RadioButtonList>
Code to Bind Data for RadioButtonList in .Ascx.cs file
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb currentWeb = SPContext.Current.Web;
SPList lstArticles = currentWeb.Lists["Articles"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<OrderBy><FieldRef Name='Title' Ascending='True' /></OrderBy>";
sQuery.ViewFields = "<FieldRef Name='Title' />";
sQuery.ViewFieldsOnly = true;
SPListItemCollection myColl = lstArticles.GetItems(sQuery);
if (myColl.Count > 0)
{
rblArticles.DataSource = myColl.GetDataTable();
rblArticles.DataBind();
}
});
Subscribe to:
Posts (Atom)