<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"><h3> <asp:Label ID="ListHeader" runat="server" Text="Agents" ></asp:Label></h3><p> <asp:Label ID="ListExplanation" runat="server" Text="Real estate agents in your organization" ></asp:Label></p><div class="container"> <div class="row10"> <div class="one column" > </div> <div class="fourteen columns" > <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True" OnNeedDataSource="RadGrid1_NeedDataSource" Width="99.7%" AutoGenerateColumns="false" AllowPaging="false" OnItemDataBound="RadGrid1_ItemDataBound" AllowFilteringByColumn="True"> <ExportSettings HideStructureColumns="true" Csv-ColumnDelimiter="Comma" IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="true" > </ExportSettings> <MasterTableView Width="100%" CommandItemDisplay="Top" EnableViewState="true"> <PagerStyle Mode="Slider"></PagerStyle> <CommandItemTemplate> <table class="rcCommandTable" width="100%"> <tr> <td style="float: right; vertical-align:middle;" > <asp:ImageButton runat="server" ID="btnCSVExport" ImageUrl="../Icons/csvdownload.jpg" CommandName="ExportToCSV" Height="24px" Width="24px" ToolTip="Export to CSV" /> <asp:ImageButton runat="server" ID="btnExcelExport" ImageUrl="../Icons/excel.png" CommandName="ExportToExcel" Height="24px" Width="24px" ToolTip="Export to Excel" /> <asp:ImageButton runat="server" ID="btnWordExport" ImageUrl="../Icons/ms_word_2.png" CommandName="ExportToWord" Height="24px" Width="24px" ToolTip="Export to Word" /> </td> </tr> </table> </CommandItemTemplate> <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true" ShowExportToCsvButton="true" ShowExportToPdfButton="false"> </CommandItemSettings> </MasterTableView> </telerik:RadGrid> </div> <div class="one column" > </div> </div></div>protected void Page_Init(object sender, System.EventArgs e){ if (!Page.IsPostBack) { sType = Request["T"]; // Get the users form security rules and set the buttons accordingly string sUserFormRules = Convert.ToString(Session["UserBrokerPlusFormsRules"]); string sRule = ""; switch (sType) { case "A": // Active this.ListHeader.Text = "Active Agents"; this.ListExplanation.Text = "Real estate agents presently working for your organization"; sRule = sUserFormRules.Substring(21, 1); break; case "I": // Inactive this.ListHeader.Text = "Inactive Agents"; this.ListExplanation.Text = "Real estate agents that are not working for your organization but are still on the roster"; sRule = sUserFormRules.Substring(22, 1); break; case "T": // Terminated this.ListHeader.Text = "Terminated Agents"; this.ListExplanation.Text = "Real estate agents that worked for your organization in the past"; sRule = sUserFormRules.Substring(23, 1); break; default: Response.Redirect("~/UserNotAuthorized.aspx"); break; } switch (sRule) { case "0": // the user is not authorized for this page, so send them to the error page Response.Redirect("~/UserNotAuthorized.aspx"); break; case "1": // The user is only authorized for read-only activities, so set the buttons accordingly this.CreateNew.Enabled = false; break; case "2": // The user is authorized to update data, so leave the buttons as is break; } this.RadGrid1.AllowFilteringByColumn = true; GridHyperLinkColumn hypercolumn = null; GridBoundColumn boundcolumn = null; hypercolumn = new GridHyperLinkColumn(); this.RadGrid1.Columns.Add(hypercolumn); hypercolumn.HeaderText = "Edit"; hypercolumn.UniqueName = "Agent"; hypercolumn.Text = "<img border=\"0\" alt=\"View\" src=\"../Icons/pencil_16.png\" />"; hypercolumn.DataNavigateUrlFields = new string[] { "Agent" }; hypercolumn.DataNavigateUrlFormatString = "OfcAgentEdit.aspx?M=Y&T=" + sType + "K=" + "{" + "0" + "}"; hypercolumn.AllowFiltering = false; hypercolumn.HeaderStyle.Width = Unit.Pixel(50); hypercolumn.Exportable = false; hypercolumn = null; hypercolumn = new GridHyperLinkColumn(); this.RadGrid1.Columns.Add(hypercolumn); hypercolumn.HeaderText = "Email"; hypercolumn.UniqueName = "SendAgentMail"; hypercolumn.Text = "<img border=\"0\" alt=\"View\" src=\"../Icons/mailIcon.gif\" />"; hypercolumn.DataNavigateUrlFields = new string[] { "AgentEmail" }; hypercolumn.DataNavigateUrlFormatString = "mailto:" + "{" + "0" + "}"; hypercolumn.HeaderStyle.Width = Unit.Pixel(30); hypercolumn.AllowFiltering = false; hypercolumn.Exportable = false; hypercolumn = null; boundcolumn = new GridBoundColumn(); this.RadGrid1.Columns.Add(boundcolumn); boundcolumn.UniqueName = "AgentID"; boundcolumn.DataField = "AgentID"; boundcolumn.HeaderText = "ID"; boundcolumn.FilterControlWidth = Unit.Pixel(50); boundcolumn.HeaderStyle.CssClass = "mediumgridcol"; boundcolumn.ItemStyle.CssClass = "mediumgridcol"; boundcolumn.FooterStyle.CssClass = "mediumgridcol"; boundcolumn.Visible = true; boundcolumn = null; boundcolumn = new GridBoundColumn(); this.RadGrid1.Columns.Add(boundcolumn); boundcolumn.UniqueName = "AgentFullName"; boundcolumn.DataField = "AgentFullName"; boundcolumn.HeaderText = "Name"; boundcolumn.HeaderStyle.Width = Unit.Pixel(240); boundcolumn.FilterControlWidth = Unit.Pixel(100); boundcolumn.Visible = true; boundcolumn = null; // this code is left here as a working example of displaying a short date in a RadGrid column //boundcolumn = new GridBoundColumn(); //this.RadGrid1.Columns.Add(boundcolumn); //boundcolumn.UniqueName = "NewsEndDate"; //boundcolumn.DataField = "NewsEndDate"; //boundcolumn.HeaderText = "End"; //boundcolumn.DataFormatString = "{0:MM/dd/yy}"; //boundcolumn.Visible = true; //boundcolumn = null; boundcolumn = new GridBoundColumn(); this.RadGrid1.Columns.Add(boundcolumn); boundcolumn.UniqueName = "OfficeCommonName"; boundcolumn.DataField = "OfficeCommonName"; boundcolumn.HeaderText = "Office"; boundcolumn.FilterControlWidth = Unit.Pixel(100); boundcolumn.HeaderStyle.CssClass = "largegridcol"; boundcolumn.ItemStyle.CssClass = "largegridcol"; boundcolumn.FooterStyle.CssClass = "largegridcol"; boundcolumn.Visible = true; boundcolumn = null; boundcolumn = new GridBoundColumn(); this.RadGrid1.Columns.Add(boundcolumn); boundcolumn.UniqueName = "AgentCellular"; boundcolumn.DataField = "AgentCellular"; boundcolumn.HeaderText = "Cellular"; boundcolumn.FilterControlWidth = Unit.Pixel(60); boundcolumn.HeaderStyle.CssClass = "smallgridcol"; boundcolumn.ItemStyle.CssClass = "smallgridcol"; boundcolumn.FooterStyle.CssClass = "smallgridcol"; boundcolumn.Visible = true; boundcolumn = null; boundcolumn = new GridBoundColumn(); this.RadGrid1.Columns.Add(boundcolumn); boundcolumn.UniqueName = "AgentEmail"; boundcolumn.DataField = "AgentEmail"; boundcolumn.HeaderText = "Email"; boundcolumn.HeaderStyle.CssClass = "smallgridcol"; boundcolumn.ItemStyle.CssClass = "smallgridcol"; boundcolumn.FooterStyle.CssClass = "smallgridcol"; boundcolumn.Visible = true; boundcolumn.FilterControlWidth = Unit.Pixel(100); boundcolumn = null; RadGrid1.AllowPaging = Convert.ToBoolean(Session["ShowListsWithPaging"]); RadGrid1.PageSize = 20; } else { sType = Request["T"]; }}protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e){ // this code is used to make filter columns visible/invisible as the grid grows/shrinks if (e.Item is GridFilteringItem) { GridFilteringItem Filter = (GridFilteringItem)e.Item; Filter["AgentID"].CssClass = "mediumgridcol"; Filter["OfficeCommonName"].CssClass = "largegridcol"; Filter["AgentCellular"].CssClass = "smallgridcol"; Filter["AgentEmail"].CssClass = "smallgridcol"; } //// this code is left here for a working example of modifying column contents in a RadGrid //if (e.Item is GridDataItem) //{ // GridDataItem dataBoundItem = e.Item as GridDataItem; // string strColumnValue1 = dataBoundItem["VendorShowInLists"].Text; // if (strColumnValue1 == "0") // { // dataBoundItem["VendorShowInLists"].Text = "No"; // } // else // { // dataBoundItem["VendorShowInLists"].Text = "Yes"; // } //}}protected void CreateNew_Click(object sender, EventArgs e){ Response.Redirect("OfcAgentEdit.aspx?M=N&K=&T=" + sType);}public DataTable GetDataTable(){ String ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["BrokerPlus"].ConnectionString; DataTable dt = new DataTable(); string sStatusNeeded = ""; switch (sType) { case "A": // Active sStatusNeeded = "Active"; break; case "I": // Inactive sStatusNeeded = "Inactive"; break; case "T": // Terminated sStatusNeeded = "Terminated"; break; default: Response.Redirect("~/UserNotAuthorized.aspx"); break; } switch (Convert.ToString(Session["UserDataProfile"])) { case "Enterprise": using (SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["BrokerPlus"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("Agents_GetAllByAgentType_And_Account", sqlcon)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@AgentStatus", sStatusNeeded)); cmd.Parameters.Add(new SqlParameter("@AgentRecType", "Agent")); cmd.Parameters.Add(new SqlParameter("@Account", Convert.ToInt32(Session["UserAccount"]))); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); return dt; } } } case "Company": using (SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["BrokerPlus"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("Agents_GetAllByAgentType_And_Company", sqlcon)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@AgentStatus", sStatusNeeded)); cmd.Parameters.Add(new SqlParameter("@AgentRecType", "Agent")); cmd.Parameters.Add(new SqlParameter("@Company", Convert.ToInt32(Session["UserCompany"]))); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); return dt; } } } case "Office": using (SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["BrokerPlus"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("Agents_GetAllByAgentType_And_Office", sqlcon)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@AgentStatus", sStatusNeeded)); cmd.Parameters.Add(new SqlParameter("@AgentRecType", "Agent")); cmd.Parameters.Add(new SqlParameter("@Office", Convert.ToInt32(Session["UserOffice"]))); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); return dt; } } } case "Agent": Response.Redirect("~/UserNotAuthorized.aspx"); break; } return dt;}protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e){ RadGrid1.DataSource = GetDataTable();}Hello,
I am having a strange problem with the RadGrid on IE 9. The grid looks fine when published to a site, but when I am debugging code in Visual Studio 2008 the column alignment does not align with the headers. This is affecting all grids in every .NET project that I have, but again - only when debugging or browsing the page from within Visual Studio.
This issue originally occurred when I went to IE 9 and only occurs when debugging or browsing a page in Visual Studio. I had found a fix before, but cannot remember what the fix was (it was a either a setting in either IE or a modification to the skin for the grid) and cannot find it now. Once the latest ASP.NET AJAX update was applied, the issue came back. A sample of a grid that is affected by this issue is provided below.
<asp:Content ID="ViewEventLogContent" ContentPlaceHolderID="ViewEventLogContent" Runat="Server"> <asp:Panel ID="pnlEventLog" runat="server" Visible="false"> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="gridTableStyle"> <tr><td style="height:10px"> </td></tr> <tr> <td> <telerik:RadGrid ID="RadGridEventLog" runat="server" AutoGenerateColumns="false" AllowSorting="True" AllowPaging="true" Skin="Simple" ClientSettings-Resizing-AllowColumnResize="true" ItemStyle-Wrap="false" Width="95%" HeaderStyle-Wrap="false" PageSize="10" OnNeedDataSource="RadGridEventLog_NeedDataSource"> <PagerStyle Mode="NumericPages" /> <ClientSettings> <Scrolling AllowScroll="true" UseStaticHeaders="true" /> </ClientSettings> <MasterTableView TableLayout="Fixed" AllowMultiColumnSorting="true" DataKeyNames="EventLogId" ShowFooter="false" PagerStyle-AlwaysVisible="false" > <Columns> <telerik:GridBoundColumn DataField="EventLogId" HeaderButtonType="TextButton" HeaderText="Event Log ID" HeaderStyle-Width="100" /> <telerik:GridBoundColumn DataField="CampaignId" HeaderButtonType="TextButton" HeaderText="Campaign ID" HeaderStyle-Width="80" /> <telerik:GridBoundColumn DataField="EventStatusDesc" HeaderButtonType="TextButton" HeaderText="Event Status" HeaderStyle-Width="160" /> <telerik:GridBoundColumn DataField="EventTypeDesc" HeaderButtonType="TextButton" HeaderText="Event Type" HeaderStyle-Width="100" /> <telerik:GridBoundColumn DataField="EventReasonDesc" HeaderButtonType="TextButton" HeaderText="Event Reason" HeaderStyle-Width="100" /> <telerik:GridBoundColumn DataField="EventMessage" HeaderButtonType="TextButton" HeaderText="Event Message" HeaderStyle-Width="200" /> <telerik:GridBoundColumn DataField="FirstName" HeaderButtonType="TextButton" HeaderText="First Name" HeaderStyle-Width="150" /> <telerik:GridBoundColumn DataField="LastName" HeaderButtonType="TextButton" HeaderText="Last Name" HeaderStyle-Width="150" /> <telerik:GridBoundColumn DataField="ProfDesignation" HeaderButtonType="TextButton" HeaderText="Prof. Designation" HeaderStyle-Width="200" /> <telerik:GridBoundColumn DataField="StateLicenseNumber" HeaderButtonType="TextButton" HeaderText="SLN" HeaderStyle-Width="200" /> <telerik:GridBoundColumn DataField="StateOfLicensure" HeaderButtonType="TextButton" HeaderText="State of Licensure" HeaderStyle-Width="200" /> <telerik:GridBoundColumn DataField="EmailAddress" HeaderButtonType="TextButton" HeaderText="Email" HeaderStyle-Width="250" /> <telerik:GridDateTimeColumn DataField="CreateDate" HeaderButtonType="TextButton" HeaderText="Date" HeaderStyle-Width="150" DataFormatString="{0:MM/dd/yyyy hh:mm:ss tt}" /> </Columns> </MasterTableView> </telerik:RadGrid> </td> </tr> </table> </asp:Panel></asp:Content>
Thanks,
<?xml version="1.0" encoding="utf-8" ?><siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode title="Home" url="Default.aspx"> <siteMapNode title="Base info" url=""> <siteMapNode title="provinces" url="~/AppUsers/addProvince.aspx"/> <siteMapNode title="Cities" url="~/AppUsers/addCity.aspx" /> <siteMapNode title="Sender" url="~/AppUsers/addFactory.aspx" /> <siteMapNode title="NVP" url="~/AppUsers/addRepresentation.aspx"/> </siteMapNode><telerik:RadMenu ID="RadMenu1" runat="server" DataSourceID="RadSiteMapDataSource1" > </telerik:RadMenu> <telerik:RadSiteMapDataSource ID="RadSiteMapDataSource1" runat="server" ShowStartingNode="false" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <ClientEvents OnRequestStart="onRequestStart" OnResponseEnd="hideHourGlass" /> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadCodeBlock1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadMultiPageReporting" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadListBoxActiveLayer"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadMultiPageReporting" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadMultiPageReporting"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadMultiPageReporting"></telerik:AjaxUpdatedControl> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Transparency="20" Skin="Default" /> <telerik:RadMultiPage runat="server" ID="RadMultiPageReporting" SelectedIndex="4"> <telerik:RadPageView runat="server" CssClass="radPageView" ID="RadPageView1"> <div> <uc:CCTVGrid runat="server" ID="CCTVGridUserControl" /> </div> </telerik:RadPageView> <telerik:RadPageView runat="server" CssClass="radPageView" ID="RadPageView2"> <div> <uc:CommSegmentsGrid runat="server" ID="CommSegmentsGridUserControl" /> </div> </telerik:RadPageView> <telerik:RadPageView runat="server" CssClass="radPageView" ID="RadPageView3"> <div> <uc:DetectorsGrid runat="server" ID="DetectorsGridUserControl" /> </div> </telerik:RadPageView> <telerik:RadPageView runat="server" CssClass="radPageView" ID="RadPageView4"> <div> <uc:DMSGrid runat="server" ID="DMSGridUserControl" /> </div> </telerik:RadPageView> <telerik:RadPageView runat="server" CssClass="radPageView" ID="RadPageView5"> <div> <uc:TrafficSignalsGrid runat="server" ID="TrafficSignalsGridUserControl" /> </div> </telerik:RadPageView> </telerik:RadMultiPage><telerik:RadGrid ID="RadGridTrafficSignals" runat="server" CssClass="gridClass" GridLines="None" AutoGenerateColumns="False" AllowSorting="True" EnableHeaderContextMenu="True" Width="98%" Height="636px" OnNeedDataSource="RadGridTrafficSignals_NeedDataSource" OnUpdateCommand="RadGridTrafficSignals_OnUpdateCommand" OnItemUpdated="RadGridTrafficSignals_ItemUpdated" OnDataBound="RadGridTrafficSignals_DataBound" OnItemCommand="RadGridTrafficSignals_ItemCommand" OnItemCreated="RadGridTrafficSignals_OnItemCreated" CellSpacing="0" AllowFilteringByColumn="True" ShowGroupPanel="True" ShowStatusBar="False"> <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True"> <ClientEvents OnRowClick="RowClick" OnRowDblClick="RowDblClick" OnGridCreated="GridCreated" OnCommand="GridCommand"></ClientEvents> <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" ScrollHeight="458px"></Scrolling> <Virtualization EnableVirtualization="true" ItemsPerView="100" LoadingPanelID="RadAjaxLoadingPanel1" /> </ClientSettings>...</telerik:RadGrid><asp:Button ID="Button2" Text="Export RadEditor content to PDF" runat="server" OnClick="Button2_Click"></asp:Button> <br /> <br /> <telerik:RadEditor ID="RadEditor1" runat="server" ContentFilters="DefaultFilters,PdfExportFilter"> <ExportSettings OpenInNewWindow="true"> </ExportSettings> <Content> Test pdf content </Content> </telerik:RadEditor>protected void Button2_Click(object sender, EventArgs e){ RadEditor1.ExportToPdf();}