Posts

Showing posts from April, 2008

Why the Elephants Don't Run?

Why the Elephants Don't Run? A number of years ago, I had the rather unique experience of being backstagein Madison Square Garden, in New York, during the Ringling Brothers Barnum &Bailey Circus. To say the least, it was a fascinating experience. I was ableto walk around looking at the lions, tigers, giraffes and all the othercircus animals. As I was passing the elephants, I suddenly stopped, confusedby the fact that these huge creatures were being held by only a small ropetied to their front leg. No chains, no cages. It was obvious that theelephants could, at any time, break away from their bonds but for somereason, they did not. I saw a trainer near by and asked why these beautiful,magnificent animals just stood there and made no attempt to get away."Well," he said, "when they are very young and much smaller we use the samesize rope to tie them and, at that age, it's enough to hold them. As theygrow up, they are conditioned to believe they cannot break away

GridView Manual Sorting

/// /// The GridView_OnSorting event which is fired when the header of the column to sort is clicked. /// /// /// protected void gvItems_Sorting(object sender, GridViewSortEventArgs e) { try { DataTable dt = GetAllItems(); DataView dv = new DataView(dt); if (GridViewSortDirection == SortDirection.Ascending) { GridViewSortDirection = SortDirection.Descending; dv.Sort = e.SortExpression + " DESC"; } else { GridViewSortDirection = SortDirection.Ascending; dv.Sort = e.SortExpression + " ASC"; } gvItems.DataSource = dv; gvItems.DataBind(); } catch (Exception ex) { } } /// /// The GridV

To Read, Write, append and Edit To XML File

Write To The XML File: filename = Server.MapPath("test.xml"); string strId = "1"; string strFourmName = "NewlyDiagnose"; string strTopic = "how r u"; string strUserName = "jaimin"; string strPostBy = "modi"; string strDate = "11/11/2007"; XmlTextWriter xtw = new XmlTextWriter(filename, null); xtw.Formatting = Formatting.Indented; xtw.WriteStartDocument(); xtw.WriteStartElement(strFourmName); xtw.WriteStartElement("item"); xtw.WriteAttributeString("Id", strId); xtw.WriteElementString("Topic", strTopic); xtw.WriteElementString("UserName", strUserName); xtw.WriteElementString("PostBy", strPostBy); xtw.WriteElementString("Date", strDate); xtw.WriteEndElement(); xtw.WriteEndElement(); xtw.WriteEndDocument(); xtw.Flush(); xtw.Close(); // for append file......... XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath("test.xml")); XmlElement s = doc

To Read and Write to Excel file

Image
string strFilePath = FileUpload1.PostedFile.FileName; string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ strFilePath+";Extended Properties=Excel 8.0;"; //write into excel file OleDbConnection oldbcon=new OleDbConnection(connectionString); OleDbCommand oldc = new OleDbCommand("Insert into [Age$](Name,Age) values('Nirav',23)", oldbcon); oldbcon.Open(); int i=oldc.ExecuteNonQuery(); oldbcon.Close(); //Read from Excel file DataSet cities = new DataSet(); OleDbDataAdapter oledbAd = new OleDbDataAdapter("Select * from [Age$]", connectionString); oledbAd.Fill(cities); GridView1.DataSource = cities; GridView1.DataBind(); //The Excel File

Good To Know

Here are somethings you may not know...... 1. Coca-Cola was originally green. ---------------------------------------------------------------------- 2. The most common name in the world is Mohammed. ---------------------------------------------------------------------- 3. The name of all the continents ends with the same letter that they start with. ---------------------------------------------------------------------- 4. The strongest muscle in the body is the tongue. ---------------------------------------------------------------------- 5. There are two credit cards for every person in the United States . ---------------------------------------------------------------------- 6. TYPEWRITER is the longest word that can be made using the letters only on one row of the keyboard. ---------------------------------------------------------------------- 7. Women blink nearly twice as much as men! --------------------------------------------------------------------- 8. Y

Even if u answer **five** questions its great...Feel proud...

Even if u answer **five** questions its great...Feel proud... 1. What programming language is GOOGLE developed in? 2. What is the expansion of YAHOO? 3. What is the expansion of ADIDAS? 4. Expansion of Star as in Star TV Network? 5. What is expansion of "ICICI?" 6. What does "baker's dozen" signify? 7. The 1984-85 season. 2nd ODI between India and Pakistan at Sialkot - India 210/3 withVengsarkar 94*. Match abandoned. Why? 8. Who is the only man to have written the National Anthems for two different countries? 9. From what four word ex-pression does the word `goodbye` derive? 10. How was Agnes Gonxha Bojaxhiu better known? 11. Name the only other country to have got independence on Aug 15th? 12. Why was James Bond Associated with the Number 007? 13. Who faced the first ball in the first ever One day match? 14. Which cricketer played for South Africa before it was banned from internationalcricket and later represented Zimbabwe ? 15. The faces of which four Preside

Default Page Load Event Calling Every time any page navigate of the site

Problem: Default Page Load Event Calling Every time any page navigate of the site. Solution: IT happens only if you have any "img" tag with 'scr=" " ' in this case the iis will redirect the response to the default page of the site and then again it will go to your calling page. but increase the extra load of excuting default page's page_load event.

Teacher Student Jokes

Teacher:"What is your name?". Student:"Mera naam Suraj Prakash hai." Teacher:"When I ask a question in English, answer it in english." Student:"My name is Sunlight. ------------ --------- --------- --------- --------- --------- --------- ---------- Teacher: What happened in 1869? Student:Gandhi ji was born. Teacher :What happened in 1873? Student:Gandhiji was four years old. ------------ --------- --------- --------- --------- --------- --------- ---------- Question:What is the fullform of maths. Answer: Mentally affected teachers harassing students ------------ --------- --------- --------- --------- --------- --------- -------------- Teacher : Now children , if I saw a man beating a donkey and stopped him then what virtue would I be showing ? Student : BROTHERLY LOVE ------------ --------- --------- --------- --------- --------- --------- -------------- Teacher :Because of Gandhiji's hard work what do we get on 15th August. Student:A holiday ---