How to convert Color to it’s corresponding Hexadecimal value

VB.NET Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ’Put user code to initialize the page here Response.Write(ToHexColor(Color.Blue)) End Sub Function ToHexColor(ByVal c As Color) As String Return ‘#’ + c.ToArgb().ToString(‘x’).Substring(2) End Function C# private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here Response.Write(ToHexColor(Color.Blue)); } string ToHexColor(Color c ) { return ‘#’ + c.ToArgb().ToString(‘x’).Substring(2); }

How to read data from the XML file using FileStream and display it in a DataGrid

Use namespace System.IO VB.NET dim ds as new DataSet() dim fs as FileStream = new FileStream (Server.MapPath (‘products.xml’),FileMode.Open , FileAccess.Read ) ds.ReadXml (fs) DataGrid1.DataSource = ds DataGrid1.DataBind () C# DataSet ds= new DataSet (); FileStream fs = new FileStream (Server.MapPath (‘products.xml’),FileMode.Open , FileAccess.Read ); ds.ReadXml (fs); DataGrid1.DataSource = ds; DataGrid1.DataBind ();