Monday, March 26, 2007

Format your c#,VB code for websites and blog
This tool allows you to format your C#, VB, HTML, XML, T-SQL or MSH (code name Monad) code for publishing on a web site or in a blog.

below is a sample c# code formated

privatevoid grdAttachments_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
CheckBox chk;
if(e.Item.ItemIndex>=0)
{
e.Item.Attributes.Add("onmouseover", "this.style.background='#cdcdcd';");
e.Item.Attributes.Add("onmouseout", "this.style.background='#cdcdcd';");

e.Item.Cells[2].Attributes.Add("onmouseout", "this.style.background='#bbbbbb';");
e.Item.Cells[2].Attributes.Add("onmouseout", "this.style.background='#ffffff';");


Button btn=new Button();

btn = (Button)e.Item.Cells[2].Controls[0];//if the button is in the 4th cell

btn.Attributes.Add("onclick","return confirm('" + e.Item.Cells[0].Text + "')");

//btn.Visible = false;

chk=(CheckBox)e.Item.Cells[0].FindControl("CheckBox1");
chk.Attributes.Add("Onclick","javascript:Alert();");
//chk.Visible= false;

DropDownList drp;
drp = (DropDownList)e.Item.Cells[0].FindControl("DropDownList3");
drp.Items.Add(new ListItem("aaaa","1"));

}

}


more info

also google have a tool which is used for code formating .
more info