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;
}