<div> <table cellspacing="0" cellpadding="2" rules="all" CssSelectorClass="PrettyGridView" border="1" id="ctl00_ctl00_MainContent_LiveExample_GridView1" style="border-collapse:collapse;"> <tr style="color:Cyan;background-color:#284775;"> <td colspan="4"><table border="0"> <tr> <td><span>1</span></td><td><a href="javascript:__doPostBack('ctl00$ctl00$MainContent$LiveExample$GridView1','Page$2')" style="color:Cyan;">2</a></td><td><a href="javascript:__doPostBack('ctl00$ctl00$MainContent$LiveExample$GridView1','Page$3')" style="color:Cyan;">3</a></td> </tr> </table></td> </tr><tr style="color:#F7F6F3;background-color:#5D7B9D;font-weight:bold;"> <th scope="col"><a href="javascript:__doPostBack('ctl00$ctl00$MainContent$LiveExample$GridView1','Sort$Operation')" style="color:#F7F6F3;">Operation</a></th><th scope="col"><a href="javascript:__doPostBack('ctl00$ctl00$MainContent$LiveExample$GridView1','Sort$Reps')" style="color:#F7F6F3;">Repetitions</a></th><th scope="col"><a href="javascript:__doPostBack('ctl00$ctl00$MainContent$LiveExample$GridView1','Sort$Duration')" style="color:#F7F6F3;">Total test duration milliseconds</a></th><th scope="col"><a href="javascript:__doPostBack('ctl00$ctl00$MainContent$LiveExample$GridView1','Sort$Average')" style="color:#F7F6F3;">Average cost per rep microseconds</a></th> </tr><tr style="color:#333333;background-color:White;"> <td>Abs</td><td>80577</td><td>31</td><td>0.3872</td> </tr><tr style="color:#333333;background-color:#F7F6F3;"> <td>Acos</td><td>70757</td><td>31</td><td>0.4410</td> </tr><tr style="color:#333333;background-color:White;"> <td>Asin</td><td>71552</td><td>31</td><td>0.4361</td> </tr><tr style="color:#333333;background-color:#F7F6F3;"> <td>Atan</td><td>72778</td><td>31</td><td>0.4287</td> </tr><tr style="color:#333333;background-color:White;"> <td>Atan2</td><td>67429</td><td>31</td><td>0.4627</td> </tr><tr style="color:#333333;background-color:#F7F6F3;"> <td>BigMul</td><td>78736</td><td>31</td><td>0.3963</td> </tr><tr style="color:#333333;background-color:White;"> <td>Ceiling</td><td>78545</td><td>31</td><td>0.3972</td> </tr><tr style="color:#333333;background-color:#F7F6F3;"> <td>Cos</td><td>72142</td><td>31</td><td>0.4325</td> </tr><tr style="color:#333333;background-color:White;"> <td>Cosh</td><td>71832</td><td>31</td><td>0.4344</td> </tr><tr style="color:#333333;background-color:#F7F6F3;"> <td>DivRem</td><td>74200</td><td>31</td><td>0.4205</td> </tr><tr style="color:Cyan;background-color:#284775;"> <td colspan="4"><table border="0"> <tr> <td><span>1</span></td><td><a href="javascript:__doPostBack('ctl00$ctl00$MainContent$LiveExample$GridView1','Page$2')" style="color:Cyan;">2</a></td><td><a href="javascript:__doPostBack('ctl00$ctl00$MainContent$LiveExample$GridView1','Page$3')" style="color:Cyan;">3</a></td> </tr> </table></td> </tr> </table> </div>
Anil Pandey
Thursday 9 February 2012
Snippet of HTML when not using the adapters
Multidimensional Arrays (C# Programming Guide)
// Two-dimensional array. int[,] array2D = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // The same array with dimensions specified. int[,] array2Da = new int[4, 2] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // A similar array with string elements. string[,] array2Db = new string[3, 2] { { "one", "two" }, { "three", "four" }, { "five", "six" } }; // Three-dimensional array. int[, ,] array3D = new int[,,] { { { 1, 2, 3 }, { 4, 5, 6 } }, { { 7, 8, 9 }, { 10, 11, 12 } } }; // The same array with dimensions specified. int[, ,] array3Da = new int[2, 2, 3] { { { 1, 2, 3 }, { 4, 5, 6 } }, { { 7, 8, 9 }, { 10, 11, 12 } } }; // Accessing array elements. System.Console.WriteLine(array2D[0, 0]); System.Console.WriteLine(array2D[0, 1]); System.Console.WriteLine(array2D[1, 0]); System.Console.WriteLine(array2D[1, 1]); System.Console.WriteLine(array2D[3, 0]); System.Console.WriteLine(array2Db[1, 0]); System.Console.WriteLine(array3Da[1, 0, 1]); System.Console.WriteLine(array3D[1, 1, 2]); // Output: // 1 // 2 // 3 // 4 // 7 // three // 8 // 12
You also can initialize the array without specifying the rank.
int[,] array4 = { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };
If you choose to declare an array variable without initialization, you must use the new operator to assign an array to the variable. The use of new is shown in the following example.
int[,] array5; array5 = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // OK //array5 = {{1,2}, {3,4}, {5,6}, {7,8}}; // Error
Friday 6 January 2012
Send HTML E-mails with embedded image content using ASP.NET C#
To send emails with HTML formatting and to embed resources such as images, in csharp, we create an alternateview to hold the embedded resource link and then create a linked resource object for each embedded image. The content ID of the linked resource is used to embed the image in the html email. add the HTML-tagged content to the Mail Body. The important thing to remember is to set the IsBodyHtml attribute to True on the mail object.
Example for sending HTML Email with embedded content:
Example for sending HTML Email with embedded content:
MailMessage m = new MailMessage(); m.From = new MailAddress("ir@w3mentor.com", "Al Salman"); m.To.Add(new MailAddress("su@w3mentor.com", "Aman")); m.Subject = "html email with embedded image coming!"; // Create the HTML message body // Reference embedded images using the content ID string htmlBody = "<html><body><h1>Picture</h1><br><img src=\"cid:Pic1\"></body></html>"; AlternateView avHtml = AlternateView.CreateAlternateViewFromString (htmlBody, null, MediaTypeNames.Text.Html); // Create a LinkedResource object for each embedded image LinkedResource pic1 = new LinkedResource("pic.jpg", MediaTypeNames.Image.Jpeg); pic1.ContentId = "Pic1"; avHtml.LinkedResources.Add(pic1); // Create an alternate view for unsupported clients string textBody = "You must use an e-mail client that supports HTML messages"; AlternateView avText = AlternateView.CreateAlternateViewFromString (textBody, null, MediaTypeNames.Text.Plain); m.AlternateViews.Add(avHtml); m.AlternateViews.Add(avText); // Send the message SmtpClient client = new SmtpClient("smtp.w3mentor.com"); client.Send(m);
Simple LINQ to Objects example
List<Employee> employees = new List<Employee>() { new Employee { ID=1, Name="Ravi", JoinDate=new DateTime(2002, 1, 15) }, new Employee { ID=2, Name="Raja", JoinDate=new DateTime(2002, 3, 17 }, new Employee { ID=3, Name="Mani", JoinDate=new DateTime(2007, 2, 11) } }; IEnumerable<Employee> query = from e in employees where e.JoinDate.Year < 2003 orderby e.Name select e; foreach (Employee e in query) { Console.WriteLine(e.Name); }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace W3mentorLinq { public class Employee { public int ID { get; set; } public string Name { get; set; } public DateTime JoinDate { get; set; } } }
Subscribe to:
Posts (Atom)