Thursday, November 27, 2014

asp.net gridview hide cancel button in commandfield edit button

  <asp:CommandField HeaderText="Edit" ShowEditButton="True" ShowCancelButton="false"
                            />

Sunday, November 23, 2014

asp.net editable nested gridview

asp.net Difference between Convert.ToString() and .ToString()

Convert.ToString() handles null, while ToString() doesn't.

asp.net clear all session

 public void ClearSession()
        {
            HttpContext.Current.Session.Clear();
        }

asp.net remove from session

 public void RemoveFromSession(string key)
        {
            HttpContext.Current.Session.Remove(key);
        }

asp.net update value in session

 public void UpdateInSession(string key, object value)
        {
            HttpContext.Current.Session[key] = value;
        }

asp.net set value in session

   public void SetInSession(string key, object value)
        {
            if (HttpContext.Current == null || HttpContext.Current.Session == null)
            {
                return;
            }
            HttpContext.Current.Session[key] = value;
        }