Saturday, April 30, 2005

Visual Studio 2005 missing application templates

VS some times does not install all the templates by default.
You need to force the VS to include the templates for the dev.

Access the Visual Studio console:
Start- > All Programs -> Microsoft Visual Studio 2005 -> Visual Studio Tools -> Visual Studio Command Prompt.

Enter the following command and hit enter.

1. devenv /installvstemplates
No luck? go for the step 2.

2 . devenv /setup.
Still no luck, go for the following fixes.

3. Open the Options window in Visual Studio. Select Projects and Solutions. Change the Visual Studio user item template location to the folder where the standard templates are located ( C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates ).

still no luck,
Download and install Microsoft Visual Studio 2005 - Update to Support Web Application Projects found at

Wednesday, March 23, 2005

Vertical Marquee for Annoncements in sharepoint's content editor webpart

Write the following code in the 'Source Editor' of the content editor webpart's html and marquee tags!

marquee direction="UP" scrollamount="3" scrolldelay="200" width="500" height="50" bgcolor="BLUE">Insert text to scroll here!

second line! !
picture of Umakanth


Sunday, March 20, 2005

Fixed width cell in HTML in a sharepoint content editor webpart

In order to hide the exrtra characters after 200 px :

td style="table-layout:fixed;width:200px"

In order to show the scroll balrs for the extra characters after 200px:

div style="height: 123px;> width: 200px; overflow: hidden">

Friday, March 11, 2005

Data Grid to Excel export error

After trying to export a datagrid to excel with the MIME modification, you get the error:
"The file you are trying to open .xls is in a different format than specified by the file extension. verify the file is not corrupted and is from trusted source before opening the file. Do you want to open the file now"

Add the following registry entry:
start -> run -> regedit -> HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\OFFICE\12.0\EXCEL\SECURITY -> in the right pane, rightclick -> New -> DWORD value -> name -> ExtensionHardening -> value -> '0'

Value: (DWORD)"ExtensionHardening" = [0 = Disable check; 1 = Enable check and prompt; 2 = Enable check, no prompt deny open]Default setting if value not present is 1 (enable and prompt).

If you do not know the code to export the grid results to excel, below is the code:

protected void btnExcel_Click(object sender, ImageClickEventArgs e)
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.Charset = "";
// use the below code to open only .
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);


Sorting/filtering works only when there are literal controls present in the data. For a single non literal control, it fails to perform the special opearations.
Below is the code to remove the non-teralcontrols from being exported:

private void ClearControls(Control control)
for (int i=control.Controls.Count-1; i>=0; i--)
if (!(control is TableCell))
if (control.GetType().GetProperty("SelectedItem") != null)
LiteralControl literal = new LiteralControl();
literal.Text = (string)control.GetType().GetProperty("SelectedItem").GetValue(control,null);

if (control.GetType().GetProperty("Text") != null)
LiteralControl literal = new LiteralControl();
literal.Text = (string)control.GetType().GetProperty("Text").GetValue(control,null);

Tuesday, January 25, 2005

=3D and = characters in the ASP.NET/MVC HTML emails

While trying to send an HTML email from the ASP.NET, you get the junk strange characters in the output.
Eg: 1) appending "3D" (Style type =3D"text/CSS")
2) appending "=" between a two words (cell=padding)

Modify the C# code to include the below:
MailMessage message = new MailMessage(SendFrom, SendTo);
var MyplainView = AlternateView.CreateAlternateViewFromString(msgBody,null,"text/html");
MyplainView.TransferEncoding = System.Net.Mime.TransferEncoding.SevenBit;
message.IsBodyHtml = true;

Sunday, January 2, 2005

Title field hell in Sharepoint lists!

While trying to delete the "title" field from any doc lib or list, the 'delete' button missing from the UI.

work around:
Find schema.xml for the coresponding list (located in c:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\STS\LISTS\)
Search , access and delete the field.This will affect the behaviour for all the lists of that type (event,tasks ...). make a backup for the schema.xml, make changes, and save the list as a template; after you make all the mods, start over from this new template