Monday, 23 December 2013

ASP.net Exception - Object reference not set to an instance of an object.

Object reference not set to an instance of an object


Possible cause : 
You are trying to assign value to a null object.
You are trying to get value from a null object.

How to detect:
Assignment statements  => Debug and check if the left hand side objects used in the assignment is null.
Accessing value related statements => Check if the objects used in the statement is null.


SQL Error - String or binary data would be truncated

SQL Error - String or binary data would be truncated

Problem: 
Error indicates you passed a string bigger than the column in database.

Solution: 
Increase the size of your column. Or pass value within specified size.

Example:
If you have a column with datatype VARCHAR(3), and you passed a string "Test Insert" in INSERT/ other query, you get this error. So increase the size if required or pass the right value with maximum length as specified in datatype.

Thursday, 19 December 2013

Pandit Jawahar Lal Nehru - Elocution/ speech for Kids (5+) / Primary Class, LKG, UKG

Pandit Jawahar Lal Nehru

“Failure comes only when we forget our ideals, objectives and principles.”
These are the words of Pandit Jawahar lal Nehru.

Nehru was the first Prime Minister of India. He ruled India from 1947 until his death in office in 1964. Nehru is considered to be the architect of modern India.

Nehru was born on 14th November, 1889 in Allahabad. Moti Lai Nehru was his father. He got his primary education at home. He went to England for higher studies and became a lawyer.

Later he gave up his practice and joined the freedom movement under Mahatma Gandhi. When India became free on August 15, 1947, he was selected as the first Prime Minister.
He was a great leader. India made great progress under his guidance.
He was a very good writer and speaker. He wrote many famous books such as The Discovery of India,  and his autobiography, Toward Freedom.
Nehru loved children and children called him ‘Chacha Nehru’ with love. He liked Children and enjoyed their company. He always wore a rose in his dress. His birthday is celebrated as Children's Day. 
He had heart attack on 27 May 1964 and he passed away from this world. The entire world wept over his death. He was one of the builders of modern India. We always remember him fondly.
                                                 --------------------------- * ----------------------

Wednesday, 18 December 2013

My School - LKG/ UKG Kids speech (4+)

My School


The name of my school is -----------. There are many classrooms in my school. We have a library and an office room. We also have a big play ground and Kid's play area.

My Teacher is Mrs. --------. She teaches us to read and write. She also teaches us to draw, Sing and dance.

We learn good habits and manners at school. I like my school very much.

"Going to school is really fun
It is here I get to play and run
It is here I learn to read and write
to sing and dance and
never fight"

Thank you.

Tuesday, 5 November 2013

Working with GridView in ASP.Net

Issues:

(1) Gridview footer is not visible

Answer: 
Set following property of Gridview in aspx page or from code.
ShowFooter="true"

Session in ASP.Net

Difference on Session.Clear() and Session.Abandon()

      Use Session.Clear() to clear all the keys in the session. User session is still valid. Also, this will not invoke Session_End eventhandler in Global.asax.
Session.Abandon() remove the session altogether and it will execute Session_End eventhandler.

Working with ASP.Net DataList

  1. TextBox text changed event (OnTextChanged) handling in Datalist

protected void txtField_TextChanged(object sender, EventArgs e)
{
            // Get the text box.
            TextBox txtAmount = sender as TextBox;
            // Get the DataList item.
            DataListItem DLItem = txtAmount.NamingContainer as DataListItem;
            // Get a field from DataList item/ row.
            HiddenField hfSampleID = DLItem.FindControl("hfSampleID ") as HiddenField;
}