or
ClientEvents-OnDataBound
ClientEvents-OnDataBinding
ClientEvents-OnGridCreated
ClientEvents-OnGridCreating
ClientEvents-OnMasterTableViewCreated
ClientEvents-OnMasterTableViewCreating
Also, here is my code below:
function rgSchoolMonitor_OnDataBinding()
{
var grid = $find("<%=rgSchoolMonitor.ClientID %>");
var masterTableView = grid.get_masterTableView();
var pageCount = masterTableView.get_pageCount();
if (pageCount > 1)
{
//Need to Iterate Through Pages
var pageIndex = masterTableView.get_currentPageIndex();
if ((pageIndex + 1) > (pageCount - 1))
{
masterTableView.set_currentPageIndex(0);
}
else
{
masterTableView.set_currentPageIndex((pageIndex + 1));
}
}
}
<
telerik:RadPivotGrid
ID
=
"grdRACI"
runat
=
"server"
AllowFiltering
=
"False"
DataSourceID
=
"sqlRACI"
ClientSettings-Scrolling-AllowVerticalScroll
=
"false"
TotalsSettings-GrandTotalsVisibility
=
"None"
Skin
=
"Vista"
AggregatesLevel
=
"-1"
ColumnHeaderCellStyle-Width
=
"100px"
RowHeaderCellStyle-Width
=
"400px"
AggregatesPosition
=
"Columns"
OnCellDataBound
=
"grdRACI_CellDataBound"
IsFilterCommandInProgress
=
"False"
DataCellStyle-Width
=
"100px"
RowHeaderTableLayout
=
"Fixed"
ColumnHeaderTableLayout
=
"Fixed"
ShowColumnHeaderZone
=
"False"
ShowDataHeaderZone
=
"False"
ShowFilterHeaderZone
=
"False"
>
<
Fields
>
<
telerik:PivotGridRowField
DataField
=
"Task"
UniqueName
=
"column"
>
</
telerik:PivotGridRowField
>
<
telerik:PivotGridColumnField
DataField
=
"RoleName"
UniqueName
=
"column1"
>
</
telerik:PivotGridColumnField
>
<
telerik:PivotGridAggregateField
DataField
=
"RACI"
Aggregate
=
"Max"
GrandTotalAggregateFormatString
=
""
UniqueName
=
"column2"
>
</
telerik:PivotGridAggregateField
>
</
Fields
>
<
TotalsSettings
GrandTotalsVisibility
=
"None"
/>
<
ConfigurationPanelSettings
Position
=
"FieldsWindow"
/>
</
telerik:RadPivotGrid
>
protected void grdRACI_CellDataBound(object sender, PivotGridCellDataBoundEventArgs e)
{
if (e.Cell is PivotGridColumnHeaderCell)
{
PivotGridColumnHeaderCell cell = e.Cell as PivotGridColumnHeaderCell;
cell.HorizontalAlign = HorizontalAlign.Center;
cell.Wrap = true;
}
if (e.Cell is PivotGridDataCell)
{
Color CFFD_Highlight = Color.Beige;
PivotGridDataCell dataCell = e.Cell as PivotGridDataCell;
if (dataCell != null)
{
switch (dataCell.Text)
{
case ("1"):
dataCell.Text = "R";
break;
case ("2"):
dataCell.Text = "A";
break;
case ("3"):
dataCell.Text = "C";
break;
case ("4"):
dataCell.Text = "I";
break;
case ("5"):
dataCell.Text = "R/A";
break;
case ("10"):
dataCell.Text = "R";
dataCell.BackColor = CFFD_Highlight;
break;
case ("20"):
dataCell.Text = "A";
dataCell.BackColor = CFFD_Highlight;
break;
case ("30"):
dataCell.Text = "C";
dataCell.BackColor = CFFD_Highlight;
break;
case ("40"):
dataCell.Text = "I";
dataCell.BackColor = CFFD_Highlight;
break;
case ("50"):
dataCell.Text = "R/A";
dataCell.BackColor = CFFD_Highlight;
break;
}
dataCell.HorizontalAlign = HorizontalAlign.Center;
}
}
}
Private
Sub
InsertPhotoIntoDB()
Dim
sMyConn
As
String
= My.Settings.appDBConnString
Dim
myConnection
As
SqlConnection
Dim
myCommand
As
New
SqlCommand
myConnection =
New
SqlConnection(sMyConn)
myConnection.Open()
myCommand =
New
SqlCommand(
"INSERT INTO Photos(Photo) VALUES(@Photo)"
)
myCommand.Connection = myConnection
myCommand.Parameters.Add(
"@Photo"
, SqlDbType.Image, 0,
"Photo"
)
myCommand.Parameters(
"@Photo"
).Value = WhatDoIPutHere???
myCommand.ExecuteNonQuery()
myConnection.Close()
myConnection.Dispose()
End
Sub
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AjaxExample.aspx.cs" Inherits="WolperWeb.company.AjaxExample" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
script
type
=
"text/javascript"
language
=
"javascript"
src
=
"../scripts/jquery-1.4.1.js"
></
script
>
<
telerik:RadCodeBlock
ID
=
"rcbJavaScript"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
$(function () {
////////////////////////////////////////////////////////////////////////////////////////////////////////
/// TEST CODE /////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
/// REQURIED PARAMETERS : int WebID, int AccountID, string SearchTerm, int CurrentPage, int PageSize
/////////////////////////////////////////////////////////////////////////////////////////////////////
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: "ajaxexample.aspx/GetData",
data: "{ }",
success: function (result) {
var publications = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
for (var key in publications) {
if (key == "book") {
tableView.set_dataSource(publications[key]);
tableView.dataBind();
}
}
},
error: function (xhr, ajaxOptions) {
alert("error: " + xhr.responseText);
}
});
});
var tableView;
function pageLoad(sender, args) {
tableView = $find("<%= rgPublicationResults.ClientID %>").get_masterTableView();
}
function rgPublicationResults_Command(sender, args) { }
</
script
>
</
telerik:RadCodeBlock
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadGrid
ID
=
"rgPublicationResults"
runat
=
"server"
Skin
=
"Simple"
OnItemDataBound
=
"rgPublicationResults_ItemDataBound"
>
<
ClientSettings
AllowColumnsReorder
=
"true"
>
<
ClientEvents
OnCommand
=
"rgPublicationResults_Command"
/>
</
ClientSettings
>
<
MasterTableView
GridLines
=
"None"
AutoGenerateColumns
=
"false"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"BookName"
HeaderText
=
"Title"
UniqueName
=
"BookName"
/>
<
telerik:GridBoundColumn
DataField
=
"Term"
HeaderText
=
"Term"
UniqueName
=
"Author"
/>
<
telerik:GridBoundColumn
DataField
=
"BookID"
HeaderText
=
"ID"
UniqueName
=
"BookID"
/>
<
telerik:GridTemplateColumn
HeaderText
=
"Price"
UniqueName
=
"Price"
>
<
ItemTemplate
>
<%# GetPrice(Eval("Price")) %>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"TestField"
UniqueName
=
"TestField"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblTest"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
AlternatingItemStyle
VerticalAlign
=
"Top"
/>
<
ItemStyle
VerticalAlign
=
"Top"
/>
</
MasterTableView
>
</
telerik:RadGrid
>
</
form
>
</
body
>
</
html
>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using Telerik.Web.UI;
namespace WolperWeb.company
{
public partial class AjaxExample : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected string GetPrice(object Price)
{
try
{
return String.Format("Order Total: {0:C}", Price);
}
catch { return "failed"; }
}
protected void rgPublicationResults_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
{
Label lblTest = (Label)e.Item.FindControl("lblTest");
lblTest.Text = "test";
}
}
[WebMethod]
public static Dictionary<
string
, object> GetData()
{
Dictionary<
string
, object> result = new Dictionary<
string
, object>();
List<
BookData
> lBooks = new List<
BookData
>();
BookData oBook = new BookData();
oBook.Author = "John Smith";
oBook.BookID = "bk101";
oBook.BookName = "Book Number 1";
oBook.Price = 10;
lBooks.Add(oBook);
oBook = new BookData();
oBook.Author = "Bill Smith";
oBook.BookID = "bk102";
oBook.BookName = "Book Number 2";
oBook.Price = 15;
lBooks.Add(oBook);
oBook = new BookData();
oBook.Author = "Rob Smith";
oBook.BookID = "bk103";
oBook.BookName = "Book Number 3";
oBook.Price = 20;
lBooks.Add(oBook);
oBook = new BookData();
oBook.Author = "Jane Smith";
oBook.BookID = "bk104";
oBook.BookName = "Book Number 4";
oBook.Price = 25;
lBooks.Add(oBook);
result.Add("book", lBooks);
return result;
}
}
public struct BookData
{
public string BookName { get; set; }
public string BookID { get; set; }
public string Author { get; set; }
public decimal Price { get; set; }
}
}
var tableView;
function pageLoad(sender, args) {
tableView = $find("<%= rgPublicationResults.ClientID %>").get_masterTableView();
}
GridEditableItem item = e.Item
as
GridEditableItem;
Hashtable values =
new
Hashtable();
DataTable dt =
new
DataTable();
item.ExtractValues(values);