An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
|
<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="DataFormatting._Default" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
Runat
=
"server"
>
</
telerik:RadScriptManager
>
<
div
class
=
"contributionTable"
>
<
asp:PlaceHolder
ID
=
"PlaceHolder1"
runat
=
"server"
>
<
telerik:RadGrid
ID
=
"clientContribution"
runat
=
"server"
onitemdatabound
=
"clientContribution_ItemDataBound"
>
</
telerik:RadGrid
>
</
asp:PlaceHolder
>
</
div
>
</
form
>
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Diagnostics;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace DataFormatting
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
BuildTheGrid();
}
}
protected void clientContribution_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridGroupHeaderItem)
{
GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
DataRowView groupDataRow = (DataRowView)e.Item.DataItem;
}
}
#region Build the grid
private DataSet BuildTheGrid()
{
try
{
clientContribution.DataSource = null;
DataSet contributionColumns = LoadGridData();
// Define the main grid
for (int loopPos = clientContribution.MasterTableView.Columns.Count; loopPos > 0; loopPos--)
{
clientContribution.MasterTableView.Columns.RemoveAt(loopPos - 1);
}
clientContribution.ID = "MyGrid";
clientContribution.DataSource = contributionColumns;
clientContribution.Width = Unit.Percentage(98);
clientContribution.AutoGenerateColumns = false;
clientContribution.ShowStatusBar = true;
clientContribution.MasterTableView.Width = Unit.Percentage(100);
// now build the hierarchical grid
clientContribution.MasterTableView.GroupByExpressions.Add(
new GridGroupByExpression("GroupValue1 group by GroupValue1"));
clientContribution.MasterTableView.GroupByExpressions.Add(
new GridGroupByExpression("GroupValue2 group by GroupValue2"));
GridBoundColumn boundColumn = new GridBoundColumn();
foreach (DataColumn col in contributionColumns.Tables[0].Columns)
{
boundColumn = new GridBoundColumn();
clientContribution.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField = col.ColumnName;
boundColumn.HeaderText = col.ColumnName;
boundColumn.Visible = true;
}
clientContribution.DataBind();
}
catch (Exception exc)
{
Debug.WriteLine(exc.Message);
return null;
}
finally
{
}
return null;
}
#endregion
#region Load the Grid Data
private DataSet LoadGridData()
{
// return the data to display
DataSet contributionData = new DataSet("MyData");
DataTable gridData = contributionData.Tables.Add("ContData");
gridData.Columns.Add(new DataColumn("GroupValue1"));
gridData.Columns.Add(new DataColumn("GroupValue2"));
DataColumn decCol = new DataColumn("ValueToSum");
decCol.DataType = System.Type.GetType("System.Int32");
gridData.Columns.Add(decCol);
DataColumn perCol = new DataColumn("ValueToIgnore");
perCol.DataType = System.Type.GetType("System.Int32");
gridData.Columns.Add(perCol);
DataColumn decCol2 = new DataColumn("ValueToSum2");
decCol2.DataType = System.Type.GetType("System.Int32");
gridData.Columns.Add(decCol2);
DataColumn perCol2 = new DataColumn("ValueToIgnore2");
perCol2.DataType = System.Type.GetType("System.Int32");
gridData.Columns.Add(perCol2);
DataColumn decCol3 = new DataColumn("ValueToSum3");
decCol3.DataType = System.Type.GetType("System.Int32");
gridData.Columns.Add(decCol3);
DataColumn perCol3 = new DataColumn("ValueToIgnore3");
perCol3.DataType = System.Type.GetType("System.Int32");
gridData.Columns.Add(perCol3);
for (int j = 1; j < 5; j++)
{
for (int i = 1; i < 5; i++)
{
DataRow dataRow = contributionData.Tables[0].NewRow();
dataRow["GroupValue1"] = "Header 1 as " + j.ToString();
dataRow["GroupValue2"] = "Heading 2 as " + j.ToString();
dataRow["ValueToSum"] = 1234 * i * j;
dataRow["ValueToIgnore"] = 805 * i * j;
dataRow["ValueToSum2"] = 42 * i * j;
dataRow["ValueToIgnore2"] = 901 * i * j;
dataRow["ValueToSum3"] = 651 * i * j;
dataRow["ValueToIgnore3"] = 104 * i * j;
contributionData.Tables[0].Rows.Add(dataRow);
}
}
return contributionData;
}
#endregion
}
}
Can this ASP.NET ajax control:
1. Bind or connect to an Exchange Server data store (2003 and higher)?
2. Display multiple calendars simultaneously (display 2 or more user calenders at the same time)?
3. Allow email to be sent.
I am sorry; these are more like sales questions, than technical questions, but I don't have time to test everyone's trial version of these controals (daypilot, devexpress, etc.). I just know that I need a third-party control that looks sort of like an Outlook calendar and will allow a user to save scheduled appointments directly to Exchange Server (while mobile) so that when the user returns to the office and opens Outlook, they will see the new appointments. I don't want to have to jump thru hoops, such as storing appointments elsewhere, like SQL Server, and then having to migrate the data over to Exchange. I want the ASP.NET controls to be able to read/write directly to Exchange.
When a user is mobile, they will also need to view the calendar of multiple contractors at one time, in order to figure out which contractor is available to work on a job. And while mobile, they may need to immediately send email to that contractor, so I need the web control to be able to send email messages as well.
As a Visual Studio 2010 developer, is RadCalendar right for what I need???
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head runat="server">
<title></title>
</
head>
<
body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="scriptmanager" runat="server"></telerik:RadScriptManager>
<div>
<telerik:RadTreeList ID="treelist" runat="server"
AllowPaging="True" DataKeyNames="FirstName" ParentDataKeyNames="gender"
DataSourceID="SqlDataSource1" GridLines="Horizontal" AutoGenerateColumns="true"
ShowTreeLines="False" >
<PagerStyle Mode="NextPrev" />
</telerik:RadTreeList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:TestConnectionString1 %>"
SelectCommand="SELECT [MobileNumber], [P_Id], [FirstName], [MiddleName], [LastName], [JObTitle], [DOB], [EmailID], [gender] FROM [Persons]">
</asp:SqlDataSource>
</div>
</form>
</
body>
</
html>
I'm trying to loop through all selected rows via with the code below and it works fine until I ReOrder the columns.
At that point, it returns the value in the column to the right of it. No matter how many times I reorder it, it always returns the value to the right.
Code Behind:
For Each gdi As GridDataItem In rgTimeMaterial.SelectedItems
jn = gdi("Customer").Text
Next
Asp.Net:
<
t:RadGrid
ID
=
"rgTimeMaterial"
runat
=
"server"
PageSize
=
"200"
AllowPaging
=
"True"
AllowSorting
=
"True"
AllowMultiRowSelection
=
"true"
Width
=
"995"
Height
=
"412px"
GridLines
=
"Both"
ShowFooter
=
"true"
>
<
HeaderStyle
Width
=
"100"
Wrap
=
"false"
/>
MasterTableView
EnableHeaderContextMenu
=
"true"
CellPadding
=
"0"
CellSpacing
=
"0"
AllowMultiColumnSorting
=
"true"
Width
=
"100%"
ClientDataKeyNames
=
"Job_Number"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
/>
<
Columns
>
<
t:GridClientSelectColumn
HeaderStyle-Width
=
"35"
UniqueName
=
"ClientSelectColumn"
/>
</
Columns
>
MasterTableView
>
<
ItemStyle
Font-Names
=
"Arial,Helvetica,sans-serif"
Font-Size
=
"9pt"
Wrap
=
"false"
/>
<
ClientSettings
ColumnsReorderMethod
=
"Reorder"
AllowColumnsReorder
=
"True"
AllowColumnHide
=
"true"
ReorderColumnsOnClient
=
"True"
>
<
ClientEvents
OnRowContextMenu
=
"RowContextMenu"
OnRowDblClick
=
"OnRowDblClick"
OnRowCreated
=
"RadGrid1_RowCreated"
OnRowSelected
=
"RadGrid1_RowSelected"
OnRowDeselected
=
"RadGrid1_RowDeselected"
OnGridCreated
=
"GridCreated"
/>
<
Selecting
AllowRowSelect
=
"true"
EnableDragToSelectRows
=
"true"
/>
<
Scrolling
SaveScrollPosition
=
"true"
AllowScroll
=
"true"
UseStaticHeaders
=
"True"
>
</
Scrolling
>
<
Resizing
AllowColumnResize
=
"true"
EnableRealTimeResize
=
"true"
ShowRowIndicatorColumn
=
"true"
ClipCellContentOnResize
=
"true"
AllowResizeToFit
=
"true"
/>
</
ClientSettings
>
<
PagerStyle
Position
=
"Top"
Mode
=
"NextPrevAndNumeric"
AlwaysVisible
=
"true"
/>
</
t:RadGrid
>