| <telerik:RadGrid ID="radgridAuditReports" EnableEmbeddedSkins="false" runat="server" |
| Skin="WebBlue" Width="12000px" PageSize="10" AllowSorting="true" AllowPaging="true" |
| ShowGroupPanel="false" AllowMultiRowEdit="false" AutoGenerateColumns="true" GridLines="None" |
| OnNeedDataSource="radgridAuditReports_NeedDataSource" AllowAutomaticInserts="false"> |
| <SortingSettings EnableSkinSortStyles="false" /> |
| <HeaderStyle Width="125px" /> |
| <PagerStyle CssClass="Pager" Mode="NumericPages" Position="Bottom" HorizontalAlign="Left" |
| ShowPagerText="false"></PagerStyle> |
| <CommandItemStyle HorizontalAlign="Right" /> |
| <ItemStyle HorizontalAlign="Left" Height="25px" /> |
| <AlternatingItemStyle HorizontalAlign="Left" Height="25px" /> |
| <HeaderStyle HorizontalAlign="Left" /> |
| <MasterTableView Width="100%" TableLayout="Fixed" CommandItemSettings-ShowRefreshButton="false" |
| ItemStyle-HorizontalAlign="Left" GroupHeaderItemStyle-HorizontalAlign="Left" |
| AllowSorting="true"> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="radScriptManager" runat="server" /> |
| <telerik:RadGrid ID="radGrid" AutoGenerateColumns="false" AllowSorting="true" OnNeedDataSource="radGrid_NeedDataSource" runat="server"> |
| <ClientSettings> |
| <Scrolling UseStaticHeaders="true" /> |
| </ClientSettings> |
| <MasterTableView AllowMultiColumnSorting="true" TableLayout="Fixed"> |
| <Columns> |
| <telerik:GridBoundColumn DataField="Name" DataType="System.String" HeaderText="Name" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" SortExpression="Name" AllowSorting="true" UniqueName="Name" /> |
| <telerik:GridBoundColumn DataField="Founder" DataType="System.String" HeaderText="Founder" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" SortExpression="Founder" AllowSorting="true" UniqueName="Founder" /> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| </div> |
| </form> |
| public partial class RadGridWithSorting : Page |
| { |
| private const string SettingsFilename = "Settings.bin"; |
| private Settings _settings = null; |
| private List<Company> _companies = null; |
| protected Settings Settings |
| { |
| get |
| { |
| if (this._settings == null) |
| { |
| this._settings = new Settings(); |
| } |
| return this._settings; |
| } |
| set |
| { |
| this._settings = value; |
| } |
| } |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| LoadSettings(); |
| LoadSortExpressions(); |
| if (!IsPostBack) |
| { |
| this._companies = Company.Load(); |
| Session["COMPANIES"] = this._companies; |
| } |
| else |
| { |
| this._companies = (List<Company>)Session["COMPANIES"]; |
| } |
| } |
| protected void Page_UnLoad(object sender, EventArgs e) |
| { |
| SaveSortExpressions(); |
| SaveSettings(); |
| } |
| protected void radGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| this.radGrid.DataSource = this._companies; |
| } |
| private void LoadSettings() |
| { |
| Settings = Helper.Load(SettingsFilename); |
| } |
| private void LoadSortExpressions() |
| { |
| this.radGrid.MasterTableView.SortExpressions.Clear(); |
| foreach (SortExpression sortExpression in Settings.SortExpressions) |
| { |
| GridSortExpression gridSortExpression = new GridSortExpression(); |
| gridSortExpression.FieldName = sortExpression.FieldName; |
| gridSortExpression.SortOrder = sortExpression.SortOrder; |
| this.radGrid.MasterTableView.SortExpressions.AddSortExpression(gridSortExpression); |
| } |
| } |
| private void SaveSettings() |
| { |
| Helper.Save(Settings, SettingsFilename); |
| } |
| private void SaveSortExpressions() |
| { |
| Settings.SortExpressions.Clear(); |
| foreach (GridSortExpression sortExpression in this.radGrid.MasterTableView.SortExpressions) |
| { |
| Settings.SortExpressions.Add(new SortExpression(sortExpression.FieldName, sortExpression.SortOrder)); |
| } |
| } |
| } |
| [Serializable] |
| public class Settings |
| { |
| public List<SortExpression> SortExpressions { get; set; } |
| public Settings() |
| { |
| SortExpressions = new List<SortExpression> {}; |
| } |
| public Settings(List<SortExpression> sortExpressions) |
| { |
| SortExpressions = sortExpressions; |
| } |
| } |
| [Serializable] |
| public class SortExpression |
| { |
| public string FieldName { get; set; } |
| public GridSortOrder SortOrder { get; set; } |
| public SortExpression() |
| { |
| FieldName = null; |
| SortOrder = GridSortOrder.None; |
| } |
| public SortExpression(string fieldName, GridSortOrder sortOrder) |
| { |
| FieldName = fieldName; |
| SortOrder = sortOrder; |
| } |
| } |
| <telerik:GridTableView Name="Locations" HierarchyLoadMode="ServerBind"> |
rbiImg.ResizeMode = Telerik.Web.UI.
BinaryImageResizeMode.Crop;
rbiImg.AutoAdjustImageControlSize =
false;
So when we resize the image it should be cropped.
We start out with an image 20px * 20px
We then resize the image to 10px * 20px and add an extra image also 10px * 20px (so in total we have 20 pixels * 20 pixels)
In the next round we resize the first image to 10x10 and the second 10x10 and add an extra image 10x20.
The second image is cropped correctly but the first image isn't cropped but it uses fit.
See the attached image:
You can see that the image (10x10) with the black has a different hatch style as the light grey image (10x10). Both images should look like the lightgrey image.
Is it because the original image (the one with the black background) was 20x20 and is at the end resized to 10x10 and the other image is resized from 10x20 to 10x10? They should be the same.
Any help would be appreciated.
Best regards Patrick
| protected void dbgPolicyInformation_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if (null != e.Item) |
| { |
| switch (e.CommandName) |
| { |
| case "Navigate": |
| string popupScript = "<script language='javascript'>" + "window.open('/vpcleads/vpcpolicies/vpcpolicyinformation.aspx', 'CustomPopUp', " + "'width=350, height=350, menubar=yes, resizable=no')" + "</script>"; |
| ScriptManager.RegisterStartupScript(this, this.GetType(), "PopupScript", popupScript,false); |
| break; |
| } |
| } |
| } |
| RAD WINDOW MANAGER: |
| <telerik:RadWindowManager Behaviors="Close" runat="server" ID="AddPolicy" Opacity="90" |
| ShowContentDuringLoad="true" KeepInScreenBounds="true" VisibleStatusbar="false" |
| Modal="true" Width="500px" Height="700px" Skin="Office2007"> |
| </telerik:RadWindowManager> |
| GRID OBJECT: |
| <telerik:RadGrid ID="dbgPolicyInformation" runat="server" AutoGenerateColumns="false" |
| OnNeedDataSource="dbgPolicyInformation_NeedDataSource" OnItemDataBound="dbgPolicyInformation_ItemDataBound" |
| OnInsertCommand="dbgPolicyInformation_InsertCommand" OnDeleteCommand="dbgPolicyInformation_DeleteCommand" |
| OnUpdateCommand="dbgPolicyInformation_UpdateCommand" OnCancelCommand="dbgPolicyInformation_CancelCommand" |
| OnItemCreated="dbgPolicyInformation_ItemCreated" Skin="Office2007" ShowFooter="true" |
| OnItemCommand="dbgPolicyInformation_ItemCommand"> |
| <MasterTableView Name="Policy" DataKeyNames="PolicyId,NewPolicyId" EditMode="InPlace" |
| CommandItemDisplay="Top" AllowMultiColumnSorting="True" CommandItemSettings-AddNewRecordText=""> |
| <Columns> |
| <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Navigate" HeaderText="View Policy Details" |
| Resizable="false" Reorderable="false" UniqueName="GoToLeadDetails" ImageUrl="~/Images/preview.gif" |
| Text="View Policy Details" ButtonCssClass="pointerMouseCursor" Groupable="false"> |
| <HeaderStyle Width="45px" HorizontalAlign="Center" /> |
| <ItemStyle Width="45px" HorizontalAlign="Center" /> |
| </telerik:GridButtonColumn> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1" |
| HeaderText="Quick Edit"> |
| <HeaderStyle Width="20px" /> |
| <ItemStyle CssClass="MyImageButton" /> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn DataField="PolicyId" HeaderText="PolicyId" Visible="false"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="RenewalDate" HeaderText="Renewal Date"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="CompanyName" HeaderText="Company Name"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="PolicyNumber" HeaderText="Policy"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="MarketingSourceDesc" HeaderText="Marketing Source"> |
| </telerik:GridBoundColumn> |
| <telerik:GridButtonColumn ConfirmText="Delete This Policy?" ButtonType="ImageButton" |
| CommandName="Delete" Text="Delete Policy" UniqueName="DeleteColumn1"> |
| <HeaderStyle Width="20px" /> |
| <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> |
| </telerik:GridButtonColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |