or
// Called from OnPreRender. private void RestoreOrderIndexes() { // Load the OrderIndexes saved in ViewState. var columnOrder = (Dictionary<string, int>)this.ViewState["GridColumnOrder"]; if (columnOrder == null) return; // Apply the OrderIndexes to the grid columns. foreach (string columnName in columnOrder.Keys) { var gridColumn = this.MasterTableView.Columns.FindByUniqueNameSafe(columnName); if (gridColumn != null) gridColumn.OrderIndex = columnOrder[columnName]; } }//Create the Rad GridTelerik.Web.UI.RadGrid tmpRadGrid = new Telerik.Web.UI.RadGrid();tmpRadGrid.Init += new EventHandler(tmpRadGrid_Init);tmpRadGrid.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(tmpRadGrid_NeedDataSource);tmpRadGrid.SelectedIndexChanged += new EventHandler(tmpRadGrid_SelectedIndexChanged);tmpRadGrid.MasterTableView.ExpandCollapseColumn.Visible = false;tmpRadGrid.Width = Unit.Percentage(100);tmpRadGrid.ID = "radGrid" + tabText;tmpRadGrid.Skin = "Silk";tmpRadGrid.AutoGenerateColumns = false;tmpRadGrid.AllowFilteringByColumn = true;tmpRadGrid.GroupingSettings.CaseSensitive = false;tmpRadGrid.AllowSorting = true;tmpRadGrid.ClientSettings.EnableRowHoverStyle = true;tmpRadGrid.ClientSettings.Selecting.AllowRowSelect = true;tmpRadGrid.ClientSettings.EnablePostBackOnRowClick = true;tmpRadGrid.CellPadding = 0;tmpRadGrid.CellSpacing = 0;tmpRadGrid.AllowPaging = true;tmpRadGrid.PageSize = 50;tmpRadGrid.PagerStyle.AlwaysVisible = true;//Create the columnsTelerik.Web.UI.GridTemplateColumn tmpCol_Name = new Telerik.Web.UI.GridTemplateColumn();tmpCol_Name.ItemTemplate = new GridNameColumnTemplate();tmpCol_Name.ItemStyle.Width = new Unit(150);tmpCol_Name.ItemStyle.VerticalAlign = VerticalAlign.Top;tmpCol_Name.HeaderText = "Name";tmpCol_Name.DataField = "FullName";tmpCol_Name.SortExpression = "FullName";tmpCol_Name.UniqueName = "FullName";tmpCol_Name.FilterDelay = 0;tmpCol_Name.FilterControlWidth = Unit.Percentage(80);tmpCol_Name.AutoPostBackOnFilter = true;tmpCol_Name.CurrentFilterFunction = Telerik.Web.UI.GridKnownFunction.Contains;Telerik.Web.UI.GridBoundColumn tmpCol_Title = new Telerik.Web.UI.GridBoundColumn();tmpCol_Title.ItemStyle.Width = new Unit(150);tmpCol_Title.ItemStyle.VerticalAlign = VerticalAlign.Top;tmpCol_Title.HeaderText = "Business Title";tmpCol_Title.DataField = "Title";tmpCol_Title.SortExpression = "Title";tmpCol_Title.UniqueName = "Title";tmpCol_Title.FilterDelay = 0;tmpCol_Title.FilterControlWidth = Unit.Percentage(80);tmpCol_Title.AutoPostBackOnFilter = true;tmpCol_Title.CurrentFilterFunction = Telerik.Web.UI.GridKnownFunction.Contains;Telerik.Web.UI.GridTemplateColumn tmpCol_ContactInfo = new Telerik.Web.UI.GridTemplateColumn();tmpCol_ContactInfo.ItemTemplate = new GridContactInfoColumnTemplate();tmpCol_ContactInfo.ItemStyle.Width = new Unit(100);tmpCol_ContactInfo.ItemStyle.VerticalAlign = VerticalAlign.Top;tmpCol_ContactInfo.HeaderText = "Contact Information";tmpCol_ContactInfo.DataField = "FullContactInfo";tmpCol_ContactInfo.SortExpression = "FullContactInfo";tmpCol_ContactInfo.UniqueName = "ContactInfo";tmpCol_ContactInfo.FilterDelay = 0;tmpCol_ContactInfo.FilterControlWidth = Unit.Percentage(80);tmpCol_ContactInfo.AutoPostBackOnFilter = true;tmpCol_ContactInfo.CurrentFilterFunction = Telerik.Web.UI.GridKnownFunction.Contains;Telerik.Web.UI.GridBoundColumn tmpCol_Location = new Telerik.Web.UI.GridBoundColumn();tmpCol_Location.ItemStyle.Width = new Unit(70);tmpCol_Location.ItemStyle.VerticalAlign = VerticalAlign.Top;tmpCol_Location.FilterControlWidth = Unit.Percentage(60);tmpCol_Location.DataField = "OfficeCode";tmpCol_Location.HeaderText = "Office Code";tmpCol_Location.SortExpression = "OfficeCode";tmpCol_Location.UniqueName = "Office";tmpCol_Location.FilterDelay = 0;tmpCol_Location.AutoPostBackOnFilter = true;tmpCol_Location.CurrentFilterFunction = Telerik.Web.UI.GridKnownFunction.Contains;//Add the columns to the gridtmpRadGrid.MasterTableView.Columns.Add(tmpCol_Name);tmpRadGrid.MasterTableView.Columns.Add(tmpCol_Title);tmpRadGrid.MasterTableView.Columns.Add(tmpCol_ContactInfo);tmpRadGrid.MasterTableView.Columns.Add(tmpCol_Location);tmpRadGrid.DataSource = tmpLetterContacts;tmpRadGrid.DataBind();class GridNameColumnTemplate : ITemplate{ public void InstantiateIn(Control container) { Literal lit = new Literal(); lit.DataBinding += new EventHandler(lit_DataBinding); container.Controls.Add(lit); } public void lit_DataBinding(object sender, EventArgs e) { Literal l = (Literal)sender; Telerik.Web.UI.GridDataItem container = (Telerik.Web.UI.GridDataItem)l.NamingContainer; Directory_BO.Employee tmpEmp = (Directory_BO.Employee)container.DataItem; l.Text = "<table><tr><td style='border:none;vertical-align:top;padding:0 3px 0 0 !important;' width='45px;'><img width='45px' src='/controls/EmployeePhoto.ashx?img=thumb&id=" + tmpEmp.ID + "' /></td><td style='border:none;padding:0px;vertical-align:top;'>" + tmpEmp.FullName + "</td></tr></table>"; }}class GridContactInfoColumnTemplate : ITemplate{ public void InstantiateIn(Control container) { Literal lit = new Literal(); lit.DataBinding += new EventHandler(lit_DataBinding); container.Controls.Add(lit); } public void lit_DataBinding(object sender, EventArgs e) { Literal l = (Literal)sender; Telerik.Web.UI.GridDataItem container = (Telerik.Web.UI.GridDataItem)l.NamingContainer; Directory_BO.Employee tmpEmp = (Directory_BO.Employee)container.DataItem; l.Text = tmpEmp.FullContactInfo; }}Code For the tree<telerik:RadOrgChart ID="orgchrtTree" runat="server" LoadOnDemand="Nodes" PersistExpandCollapseState="true" OnClientNodePopulated="OnClientNodePopulated"> <RenderedFields> <NodeFields> <telerik:OrgChartRenderedField DataField="Value" /> </NodeFields> <ItemFields> <telerik:OrgChartRenderedField DataField="NodeGroupID" /> </ItemFields> <ItemFields> <telerik:OrgChartRenderedField DataField="NodeID" /> </ItemFields> </RenderedFields> <GroupEnabledBinding> <NodeBindingSettings DataFieldID="GroupID" DataFieldParentID="ParentGroupID" /> <GroupItemBindingSettings DataFieldID="NodeID" DataFieldNodeID="GroupID" DataTextField="Value" /> </GroupEnabledBinding> </telerik:RadOrgChart> Code behindprotected void Page_Load(object sender, EventArgs e) { try { if (!this.IsPostBack) { } Presenter.OnViewLoaded(); orgchrtTree.GroupEnabledBinding.NodeBindingSettings.DataSource = GetTreeGroupData(); orgchrtTree.GroupEnabledBinding.GroupItemBindingSettings.DataSource = GetFollettFamilyTreeData();; orgchrtTree.DataBind(); orgchrtTree.EnableDrillDown = true; orgchrtTree.EnableCollapsing = true; orgchrtTree.EnableGroupCollapsing = true; } catch (Exception ex) { base.LogError(ex); base.ShowErrorMessage(ex.Message); } }<telerik:RadScriptManager ID="RadScriptManager" runat="server" EnablePartialRendering="true" /> <telerik:RadAjaxManager ID="RadAjaxManager" runat="server" > <ClientEvents OnResponseEnd="onResponseEnd" OnRequestStart="onRequestStart"/> <AjaxSettings > <telerik:AjaxSetting AjaxControlID="RadAjaxManager"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="listInjectors" /> <telerik:AjaxUpdatedControl ControlID="injectorsTemplate"/> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager>
<telerik:RadGrid ClientSettings-Selecting-AllowRowSelect="True" runat="server" ID="RadGrid1" AllowPaging="True" AllowSorting="true" OnSortCommand="RadGrid1_SortCommand" OnPageIndexChanged="RadGrid1_PageIndexChanged" OnPageSizeChanged="RadGrid1_PageSizeChanged" AllowFilteringByColumn="true" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged" Width="100%" OnPreRender="RadGrid1_PreRender" OnItemDataBound="RadGrid1_ItemDataBound" OnColumnsReorder="RadGrid1_ColumnsReorder"> <ClientSettings EnablePostBackOnRowClick="true" AllowColumnsReorder="true"> </ClientSettings> <MasterTableView AutoGenerateColumns="False" TableLayout="Auto"> <Columns> <telerik:GridImageColumn AllowFiltering="false" DataType="System.String" DataImageUrlFields="Image" ImageAlign="AbsMiddle" ImageHeight="100px"> </telerik:GridImageColumn>
....
For some reason my GridImageCoulmn refuses to let me place the images where I want them. It always cuts them off (see attached). I have tried every ImageAlign argument and the images do not move at all. It does not center them in the row like I have seen in every example and I cannot find anyone who has a similar issue.