NameSapce:
Using System.Text
Coding:
strtxt append any kind text numerics.
public void bindata()
{
try{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
StringBuilder strtxt = new StringBuilder();
strtxt.Append("<table width='100%'>");
strtxt.Append("<tr>");
strtxt.Append("<td bgcolor='#add8e6'>");
strtxt.Append(" Name");
strtxt.Append("</td>");
strtxt.Append("</tr>");
SPWeb currentWeb = SPContext.Current.Web;
SPList lstemp = currentWeb.Lists["Employee"];
SPListItemCollection myColl = lstemp.Items;
if (myColl.Count > 0)
{
foreach (SPListItem item in myColl)
{
string strTitle = string.Empty;
strTitle = item.Title.ToString();
strtxt.Append("<tr>");
strtxt.Append("<td>");
strtxt.Append(strTitle);
strtxt.Append("</td>");
strtxt.Append("</tr>");
}
}
strtxt.Append("</tr>");
writer.Write(strtxt);
});
}
catch (Exception ex)
{
writer.Write(ex.ToString());
}
}
}
Using System.Text
Coding:
strtxt append any kind text numerics.
public void bindata()
{
try{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
StringBuilder strtxt = new StringBuilder();
strtxt.Append("<table width='100%'>");
strtxt.Append("<tr>");
strtxt.Append("<td bgcolor='#add8e6'>");
strtxt.Append(" Name");
strtxt.Append("</td>");
strtxt.Append("</tr>");
SPWeb currentWeb = SPContext.Current.Web;
SPList lstemp = currentWeb.Lists["Employee"];
SPListItemCollection myColl = lstemp.Items;
if (myColl.Count > 0)
{
foreach (SPListItem item in myColl)
{
string strTitle = string.Empty;
strTitle = item.Title.ToString();
strtxt.Append("<tr>");
strtxt.Append("<td>");
strtxt.Append(strTitle);
strtxt.Append("</td>");
strtxt.Append("</tr>");
}
}
strtxt.Append("</tr>");
writer.Write(strtxt);
});
}
catch (Exception ex)
{
writer.Write(ex.ToString());
}
}
}
No comments:
Post a Comment