or
// Asset of a personpublic class PersonAsset { public Guid PersonID {get;} //DataKey; second GroupBy will be by PersonID public string Asset {get;set;} public Guid AssetID {get;set} //not a DataKey for the Grid, correlates to a comboxbox that makes the asset changeable public string PersonName {get;set;} public string Note1 {get;set;} public string Note2 {get;set;} public string Note3 {get;set;} public PersonAssetState State {get;set;}}//going to perform first GroupBy using this enumpublic enum PersonAssetState { NotSet, Type1, Type2}<telerik:RadGrid runat="server" ID="rGridInventory" ShowHeader="true" Width="99%" OnNeedDataSource="rGridInventory_NeedDataSource"> <MasterTableView DataKeyNames="PersonID" ClientDataKeyNames="PersonID" ShowGroupFooter="true" GroupLoadMode="Client"> <GroupFooterTemplate> </GroupFooterTemplate> <GroupByExpressions> <telerik:GridGroupByExpression> <GroupByFields> <telerik:GridGroupByField FieldName="State" SortOrder="Descending" /> <telerik:GridGroupByField FieldName="PersonID" /> </GroupByFields> <SelectFields> <telerik:GridGroupByField FieldName="State" /> <telerik:GridGroupByField FieldName="PersonID" /> </SelectFields> </telerik:GridGroupByExpression> </GroupByExpressions> </MasterTableView> </telerik:RadGrid>
if(navigator.userAgent.indexOf("Trident")>-1&&navigator.userAgent.indexOf("MSIE")==-1){Sys.Browser.agent=Sys.Browser.InternetExplorer;<%@ Page Title="" Language="C#" MasterPageFile="~/masters/BrokerPlusMstr.Master" AutoEventWireup="true" CodeBehind="OfcSourceList.aspx.cs" Inherits="BrokerPlusOffice.OfcSourceList" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <h3> Sources </h3> <p> The Sources codes are used to describe how real estate business leads were directed to your company. </p><div class="container"> <div class="row10"> <div class="one column" > </div> <div class="fourteen columns" > <telerik:RadGrid ID="RadGrid1" runat="server" ></telerik:RadGrid> </div> <div class="one column" > </div> </div></div><br /><div class="container"> <div class="row10"> <div class="sixteen columns" style="text-align: center;" > <telerik:RadButton ID="CreateNew" runat="server" Text="Create New" CausesValidation="False" ToolTip="Displays a form for adding a new Source to the database." UseSubmitBehavior="True" OnClick="CreateNew_Click" /> <telerik:RadButton ID="CloseMe" runat="server" Text="Close Window" CausesValidation="False" ToolTip= "Closes this window." UseSubmitBehavior="False" OnClientClicked="closemenow" /> </div> </div></div><div class="container"> <div class="row10"> <div class="sixteen columns" style="text-align: center;"> <asp:Label ID="PageErrors" runat="server" Font-Bold="True" ForeColor="#C00000" Width="95%"></asp:Label> </div> </div></div></asp:Content>using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using System.Data.Common;using System.Data.Sql;using System.Data.SqlClient;using System.Web.Security;using System.Configuration;using System.Collections;using Telerik.Web.UI;using ApplDB = PublixDBCS10;using BrokerPlusDBCS10;namespace BrokerPlusOffice{ public partial class OfcSourceList : Common.THDiBasePage { protected void Page_Init(object sender, System.EventArgs e) { if (!Page.IsPostBack) { // Get the users form security rules and set the buttons accordingly string sUserFormRules = Convert.ToString(Session["UserBrokerPlusFormsRules"]); string sRule = sUserFormRules.Substring(40, 1); 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; } GridHyperLinkColumn hypercolumn = null; GridBoundColumn boundcolumn = null; RadGrid1.ID = "RadGrid1"; RadGrid1.EnableViewState = false; RadGrid1.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource); RadGrid1.Width = Unit.Percentage(100); RadGrid1.PageSize = 15; RadGrid1.AllowPaging = true; RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; RadGrid1.AutoGenerateColumns = false; RadGrid1.AllowFilteringByColumn = true; RadGrid1.ExportSettings.ExportOnlyData = true; RadGrid1.ExportSettings.IgnorePaging = true; RadGrid1.ExportSettings.HideStructureColumns = true; RadGrid1.ExportSettings.OpenInNewWindow = true; RadGrid1.MasterTableView.CommandItemSettings.ShowExportToCsvButton = false; RadGrid1.MasterTableView.CommandItemSettings.ShowExportToExcelButton = false; RadGrid1.MasterTableView.CommandItemSettings.ShowExportToPdfButton = false; RadGrid1.MasterTableView.CommandItemSettings.ShowExportToWordButton = false; RadGrid1.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false; RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; RadGrid1.MasterTableView.Width = Unit.Percentage(100); RadGrid1.MasterTableView.DataKeyNames = new string[] { "Source" }; hypercolumn = new GridHyperLinkColumn(); hypercolumn.HeaderText = "Edit"; hypercolumn.UniqueName = "Source"; hypercolumn.Text = "<img border=\"0\" alt=\"View\" src=\"../Icons/pencil_16.png\" />"; hypercolumn.DataNavigateUrlFields = new string[] { "Source" }; hypercolumn.DataNavigateUrlFormatString = "OfcSourceEdit.aspx?M=Y&K=" + "{" + "0" + "}"; RadGrid1.MasterTableView.Columns.Add(hypercolumn); hypercolumn = null; boundcolumn = new GridBoundColumn(); boundcolumn.UniqueName = "SourceText"; boundcolumn.DataField = "SourceText"; boundcolumn.HeaderText = "Source"; boundcolumn.Visible = true; RadGrid1.MasterTableView.Columns.Add(boundcolumn); boundcolumn = null; RadGrid1.AllowPaging = Convert.ToBoolean(Session["ShowListsWithPaging"]); } } public DataTable GetDataTable() { String ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["BrokerPlus"].ConnectionString; DataTable dt = new DataTable(); using (SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["BrokerPlus"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("Sources_GetAllBySource_Account", sqlcon)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@Source_Account", Convert.ToInt32(Session["UserAccount"]))); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); return dt; } } } } private void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { (source as RadGrid).DataSource = GetDataTable(); } protected void CreateNew_Click(object sender, EventArgs e) { Response.Redirect("OfcSourceEdit.aspx?M=N&K="); } }}