How To Remove An Image From The Header Text Of A RadGrid Column



TODO:

Have you ever wanted to remove an image from the Header Text of a Telerik RadGrid?

 

SOLUTION:

/// <summary>
/// Add Header Image
/// </summary>
/// <param name="TargetGrid"></param>
/// <param name="HeaderText"></param>
protected void RemoveGridHeaderImage(RadGrid TargetGrid, string HeaderText)
{
     GridHeaderItem headerItem = (GridHeaderItem)TargetGrid.MasterTableView.GetItems(GridItemType.Header)[0];
     try
     {
          headerItem[HeaderText].Controls.AddAt(1, space);
          headerItem[HeaderText].Controls.AddAt(2, img);
     }
     catch
     {
     }
}

 

NOTES:

All you have to do, is call this method in the PreRender() method of your RadGrid.  You can use this in conjunction with adding an image to a RadGrid Header at this link, which will allow you to toggle the image on and off depending on the contents of the grid.

How To Replace ScriptManager With RadScriptManager When



TODO:

Have you ever wanted to replace the ScriptManager that is in the master page with the RadScriptManager?  The code below will do just this for you!

 

SOLUTION:

protected override void OnInit(EventArgs e)
{
      Page.Init += delegate(object sender,EventArgs e_Init)
      {
            if(ScriptManager.GetCurrent(Page) != null)
            {
                    Page.Items.Remove(typeof(ScriptManager));
                    Telerik.Web.UI.RadScriptManagerscriptManager = new RadScriptManager();
                    Page.Form.Controls.AddAt(0, scriptManager);
             }
       };
       base.OnInit(e);
}

NOTES:

There are no notes on this topic.

How To Remove "Log In" link from BlogEngine.Net Sites



TODO:

Have you ever wanted to get rid of the "log in" link that appears on sites created with BlogEngine.Net?

 

SOLUTION:

1.  Edit the PageMenu.cs page that is located in BlogEngine.Net\App_Code\Controls\PageMenu.cs

2.  Chagne the BindPages() method to be the code below.

3.  Build BlogEngine.Net, and copy the DLLs to your "bin" folder.

 

private HtmlGenericControl BindPages()
{
            // recursivly get all children of the root page
            HtmlGenericControl ul = GetChildren(Guid.Empty);

            // items that will be appended to the end of menu list
            AddMenuItem(ul, Contact, "~/contact.aspx");

            if (Security.IsAuthenticated)
            {
                AddMenuItem(ul, Logoff, "~/Account/login.aspx?logoff");
            }
            else
            {
                //AddMenuItem(ul, Logon, "~/Account/login.aspx");
            }

            return ul;
}

 

 

NOTES:

All I did was comment out the else so that "log in" never appears.  If you navigate to http://site/account/login.aspx, you can log in.  In the event you do log in, you will get a "log out" link, but will never get the "log in" link.