10 Answers, 1 is accepted

You can directly access the cell value of that row by using 'ColumnUniqueName'. Check out the following code snippet. Hope it might help.
C#:
protected
void
RadGrid1_ItemCommand(
object
source, GridCommandEventArgs e)
{
if
(e.CommandName ==
"Command"
)
// CommandName of LinkButton
{
GridDataItem item = (GridDataItem)e.Item;
string
value = item[
"ColumnUniqueName"
].Text;
// access the value in column using 'UniqueName' of that column
}
}
Thanks,
Shinu.

i'm binding radgrid values dynamically in page load ,
That's why i'm not getting value like that ,
How i get value dynamically binded fields
Thanks,
Mohamed.
If you want to access the already binded cells of the grid then you could loop over the grid's elements.
Here is an example:
foreach
(GridDataItem row
in
RadGrid1.MasterTableView)
{
TableCell cell = row[
"yourColumnUniqueName"
];
}
I hope this helps.
Greetings,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

hi Vasil
this error on when i put example
foreach statement cannot operate on variables of type 'telerik.web.ui.gridtableview' because 'telerik.web.ui.gridtableview' does not contain a public definition for 'getenumetotar'
Thanks,
Mohamed.
Please excuse me for my mistake, the code should be:
foreach
(GridDataItem row
in
RadGrid1.MasterTableView.Items)
{
TableCell cell = row[
"yourColumnUniqueName"
];
}
Regards,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Thanks For ur reply,
Same Error Come Like i before check .
Thanks,
Mohamed.
Could you send us the whole code that you use? I will try to debug it here and let you know what should be changed in order to work.
Greetings,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using Telerik.Web.UI;
using TDSDBConnection;
using System.Collections.Generic;
using TBSHelpDesk;
using TBS.HelpDesk.Model;
using System.Linq;
using System.Web.DynamicData;
using System.Data;
using System.Configuration;
using System.Drawing;
namespace TBS_HelpDesk.Views.Assets
{
public partial class AssetsList : System.Web.UI.Page
{
DBClientADO oDBClientADO = new DBClientADO();
public static string leaseid;
public static string servcontract;
public static string showinactive;
public static int LayoutId;
public static string LayoutName;
public static string SortColumn;
public static string SortOrder;
public static string GroupColumn;
public static string FieldsSelection = "";
public static string SelectQuery = "";
public static string LayoutFirstField = "";
public static string str2 = "";
string AssetID;
#region GENERAL
protected override void OnInit(EventArgs e)
{
//base.OnInit(e);
if (!Page.IsPostBack)
{
showinactive = "0";
LayoutId = 0;
if (Request.QueryString["LayoutId"] != null)
{
LayoutId = Convert.ToInt16(Request.QueryString["LayoutId"]);
LayoutName = Request.QueryString["LayoutName"];
}
Bindcall();
}
}
private void Bindcall()
{
if (LayoutId > 0)
{
//ProductsDataSource.SelectCommand = "SELECT AssetID, AssetName, SerialNumber FROM Assets";
RadGrid1.MasterTableView.Columns.Clear();
List<
ListLayout
> oListLayout = DbClient.GetList<
ListLayout
>("LayoutId == " + LayoutId);
if (oListLayout != null && oListLayout.Count > 0)
{
SortColumn = oListLayout[0].SortColumn.ToString();
SortOrder = oListLayout[0].SortOrder.ToString();
GroupColumn = oListLayout[0].GroupColumn.ToString();
}
if (GroupColumn != "")
{
GridGroupByExpression expression = new GridGroupByExpression();
GridGroupByField gridGroupByField = new GridGroupByField();
////Add select fields (before the "Group By" clause)
gridGroupByField = new GridGroupByField();
gridGroupByField.FieldAlias = GroupColumn;
gridGroupByField.FieldName = GroupColumn;
gridGroupByField.HeaderText = "";
gridGroupByField.HeaderValueSeparator = " : ";
gridGroupByField.FormatString = "";
expression.SelectFields.Add(gridGroupByField);
gridGroupByField = new GridGroupByField();
gridGroupByField.FieldName = GroupColumn;
expression.GroupByFields.Add(gridGroupByField);
this.RadGrid1.MasterTableView.GroupByExpressions.Add(expression);
}
GridSortExpression sortexpression = new GridSortExpression();
sortexpression.FieldName = SortColumn;
if (SortOrder == "Asc")
sortexpression.SortOrder = GridSortOrder.Ascending;
else
sortexpression.SortOrder = GridSortOrder.Descending;
this.RadGrid1.MasterTableView.SortExpressions.Add(sortexpression);
List<
ListField
> oListFields = DbClient.GetList<
ListField
>("LayoutId == " + LayoutId);
string sSelectCommand = "Select ";
int i = oListFields.Count;
string[] arr1 = new string[i];
for (i = 0; i <
arr1.Length
; i++)
{
arr1[i] = oListFields[i].FieldName.ToString();
if (i == 1)
{
LayoutFirstField
=
arr1
[1];
str2
=
oListFields
[1].FieldName.ToString();
}
if (arr1[i] == "AssetID")
{
GridBoundColumn
boundCol1
=
new
GridBoundColumn();
this.RadGrid1.MasterTableView.Columns.Add(boundCol1);
boundCol1.DataField
=
"AssetID"
;
boundCol1.HeaderText
=
"AssetID"
;
boundCol1.UniqueName
=
"AssetID"
;
boundCol1.SortExpression
=
"AssetID"
;
boundCol1.Visible
=
false
;
if (i == arr1.Length - 1)
sSelectCommand += boundCol1.DataField + " From Assets ";
else
sSelectCommand += boundCol1.DataField + ",";
}
else if (LayoutFirstField == str2)
{
GridHyperLinkColumn
boundCol2
=
new
GridHyperLinkColumn();
this.RadGrid1.MasterTableView.Columns.Add(boundCol2);
boundCol2.DataTextField
=
arr1
[1];
boundCol2.HeaderText
=
arr1
[1];
boundCol2.NavigateUrl
=
"Assets.aspx"
;
boundCol2.UniqueName
=
arr1
[1];
boundCol2.SortExpression
=
arr1
[1];
if (i == arr1.Length - 1)
sSelectCommand += boundCol2.DataTextField + " From Assets ";
else
sSelectCommand += boundCol2.DataTextField + ",";
}
else
{
GridBoundColumn
boundCol
=
new
GridBoundColumn();
this.RadGrid1.MasterTableView.Columns.Add(boundCol);
boundCol.DataField
=
arr1
[i];
boundCol.HeaderText
=
arr1
[i];
boundCol.UniqueName
=
arr1
[i];
boundCol.SortExpression
=
arr1
[i];
if (i == arr1.Length - 1)
sSelectCommand += boundCol.DataField + " From Assets ";
else
sSelectCommand += boundCol.DataField + ",";
}
str2
=
""
;
}
SelectQuery
=
sSelectCommand
;
GridButtonColumn
btncol
=
new
GridButtonColumn();
this.RadGrid1.MasterTableView.Columns.Add(btncol);
btncol.HeaderStyle.Width
=
10
;
btncol.CommandName
=
"Delete"
;
btncol.ButtonType
=
GridButtonColumnType
.ImageButton;
btncol.Text
=
"delete"
;
btncol.UniqueName
=
"DeleteColumn"
;
btncol.CommandArgument
=
"Child"
;
btncol.ConfirmDialogType
=
GridConfirmDialogType
.RadWindow;
btncol.ConfirmText
=
"Are You Sure Want To Delete This Record?"
;
btncol.ConfirmTitle
=
"Delete Confirm"
;
//
RadGrid1.DataSource
=
oDBClientADO
.GetDataSet(SelectQuery);
//RadGrid1.Rebind();
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (LayoutId == 0)
{
GridGroupByExpression
expression
=
new
GridGroupByExpression();
GridGroupByField
gridGroupByField
=
new
GridGroupByField();
////Add select fields (before the "Group By" clause)
gridGroupByField
=
new
GridGroupByField();
gridGroupByField.FieldAlias
=
"UserName"
;
gridGroupByField.FieldName
=
"ppl_Name"
;
gridGroupByField.HeaderText
=
""
;
gridGroupByField.HeaderValueSeparator
=
" : "
;
gridGroupByField.FormatString
=
""
;
expression.SelectFields.Add(gridGroupByField);
gridGroupByField
=
new
GridGroupByField();
gridGroupByField.FieldName
=
"ppl_Name"
;
expression.GroupByFields.Add(gridGroupByField);
this.RadGrid1.MasterTableView.GroupByExpressions.Add(expression);
GridBoundColumn
boundCol1
=
new
GridBoundColumn();
this.RadGrid1.MasterTableView.Columns.Add(boundCol1);
boundCol1.DataField
=
"AssetID"
;
boundCol1.SortExpression
=
"AssetID"
;
boundCol1.HeaderText
=
"AssetID"
;
boundCol1.UniqueName
=
"AssetID"
;
boundCol1.Visible
=
false
;
GridHyperLinkColumn
boundCol2
=
new
GridHyperLinkColumn();
this.RadGrid1.MasterTableView.Columns.Add(boundCol2);
boundCol2.DataTextField
=
"AssetName"
;
boundCol2.HeaderText
=
"Asset Name"
;
boundCol2.NavigateUrl
=
"Assets.aspx"
;
boundCol2.UniqueName
=
"AssetName"
;
GridBoundColumn
boundCol3
=
new
GridBoundColumn();
this.RadGrid1.MasterTableView.Columns.Add(boundCol3);
boundCol3.DataField
=
"SerialNumber"
;
boundCol3.HeaderText
=
"Serial Number"
;
boundCol3.UniqueName
=
"SerialNumber"
;
GridBoundColumn
boundCol4
=
new
GridBoundColumn();
this.RadGrid1.MasterTableView.Columns.Add(boundCol4);
boundCol4.DataField
=
"Asset_UserID"
;
boundCol4.HeaderText
=
"Asset_UserID"
;
boundCol4.UniqueName
=
"Asset_UserID"
;
boundCol4.Visible
=
false
;
GridBoundColumn
boundCol5
=
new
GridBoundColumn();
this.RadGrid1.MasterTableView.Columns.Add(boundCol5);
boundCol5.DataField
=
"ppl_Name"
;
boundCol5.HeaderText
=
"User Name"
;
boundCol5.UniqueName
=
"ppl_Name"
;
boundCol5.SortExpression
=
"ppl_Name"
;
boundCol5.Display
=
true
;
boundCol5.Groupable
=
true
;
boundCol5.GroupByExpression
=
"ppl_Name"
;
GridCheckBoxColumn
boundCol6
=
new
GridCheckBoxColumn();
this.RadGrid1.MasterTableView.Columns.Add(boundCol6);
boundCol6.DataField
=
"Asset_Inactive"
;
boundCol6.HeaderText
=
"Asset Inactive"
;
boundCol6.UniqueName
=
"Asset_Inactive"
;
GridButtonColumn
btncol
=
new
GridButtonColumn();
this.RadGrid1.MasterTableView.Columns.Add(btncol);
btncol.ButtonType
=
GridButtonColumnType
.ImageButton;
btncol.HeaderStyle.Width
=
10
;
btncol.CommandName
=
"Delete"
;
btncol.Text
=
"Delete"
;
btncol.UniqueName
=
"DeleteColumn"
;
btncol.CommandArgument
=
"Child"
;
btncol.ConfirmDialogType
=
GridConfirmDialogType
.RadWindow;
btncol.ConfirmText
=
"Are You Sure Want To Delete This Record?"
;
btncol.ConfirmTitle
=
"Delete Confirm"
;
SelectQuery
=
"SELECT a.AssetID,a.AssetName,a.SerialNumber,a.Asset_UserID,b.ppl_Name,a.Asset_Inactive FROM [Assets] a , People b "
+
"where
a.Asset_UserID
=
b
.PeopleID order by AssetName asc";
}
}
}
protected void EisDefaultToolBar_ButtonClick(object sender, RadToolBarEventArgs e)
{
string
message
= e.Item.Text;
//if (e.Item.Text == "Show Inactive")
//{
//
showinactive
=
"1"
;
// RadGrid1.Rebind();
//
RadGrid1.DataSource
=
null
;
//}
}
#endregion
#region RAD GRID
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource
=
oDBClientADO
.GetDataTable(SelectQuery);
}
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (LayoutId == 0)
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
AssetID
=
item
["AssetID"].Text.ToString();
HyperLink link = (HyperLink)item["AssetName"].Controls[0];
link.NavigateUrl = ("Assets.aspx?
AssetID
=
" + AssetID + "
");
}
}
else
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
AssetID
=
item
["AssetID"].Text.ToString();
HyperLink link = (HyperLink)item[LayoutFirstField].Controls[0];
link.NavigateUrl = ("Assets.aspx?
AssetID
=
" + AssetID + "
");
}
}
}
//protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
//{
// if (!Page.IsPostBack)
// {
// }
// else
// {
// if (e.Item is GridDataItem)
// {
// GridDataItem item = (GridDataItem)e.Item;
// TableCell
cell
=
item
["DeleteColumn"];
// ImageButton btn = (ImageButton)cell.Controls[0];
// if (btn.CommandName == "Delete")
// {
// if (e.Item is GridDataItem)
// {
// foreach (GridDataItem row in RadGrid1.MasterTableView.Items)
// {
// TableCell
cell1
=
row
["AssetID"];
// TextBox ast = (TextBox)cell1.Controls[0];
// }
// }
// }
// }
// }
//}
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
//if (!Page.IsPostBack)
//{
//}
//else
//{
// if (e.Item is GridDataItem)
// {
// GridDataItem item = (GridDataItem)e.Item;
// TableCell
cell
=
item
["DeleteColumn"];
// ImageButton btn = (ImageButton)cell.Controls[0];
// if (btn.CommandName == "Delete")
// {
// if (e.Item is GridDataItem)
// {
// GridDataItem item1 = (GridDataItem)e.Item;
// GridItem item2 = (GridItem)e.Item;
// TableCell
txtb
=
item1
["AssetID"];
// foreach (GridItem item4 in RadGrid1.MasterTableView.GetItems(new GridItemType[] { GridItemType.Item, GridItemType.AlternatingItem }))
// {
// GridDataItem dataitem = (GridDataItem)item;
// dataitem.FireCommandEvent("Delete", String.Empty);
// }
// }
// }
// }
//}
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.DeleteCommandName)
{
GridDataItem item = (GridDataItem)e.Item;
//Int32
Manuf_ID
=
Convert
.ToInt32(item["AssetID"].Text);
//string LastName = (item["AssetID"].Controls[0] as TextBox).Text;
string
AssetID
=
item
["AssetID"].Text;
//int
dt1
=
Convert
.ToInt16(AssetID);
//using (var
db1
=
new
TBSHelpDeskDataContext(Globals.strCon))
//{
// var orgReq = (from a in db1.Assets
// where a.AssetID == dt1
// select new { a.Asset_LeaseID, }).ToList();
//
leaseid
=
orgReq
[0].Asset_LeaseID.ToString();
//}
//try
//{
// int
dt
=
Convert
.ToInt16(AssetID);
// using (var
db
=
new
TBSHelpDeskDataContext(Globals.strCon))
// {
// var orgass = (from d in db.Tickets join org in db.Assets on d.Ticket_AssetID equals org.AssetID where d.Ticket_AssetID == dt select new { d.Ticket_AssetID }).ToList();
// int
i
=
orgass
.Count;
// if (i > 0)
// {
// //string script = "function f(){radconfirm('This Asset Make Use Ticket, Are Sure Delete This Asset'); Sys.Application.remove_load(f);} Sys.Application.add_load(f);";
// //ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);
// //string loadscript1 = "function f(){confirmCallBackFn()} Sys.Application.add_load(f);";
// //ScriptManager.RegisterStartupScript(this, this.GetType(), "loadscript1", loadscript1, true);
// //ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "radconfirm('This Asset Make Use Ticket, Are Sure Delete This Asset?',confirmCallBackFn, 330, 100, null,'Send Message?');", true);
// //string updateQuery = "UPDATE [Assets] SET Asset_Inactive=1 WHERE [AssetID] ='" + AssetID + "'";
// //sqlcmd.CommandText = updateQuery;
// //sqlcmd.Connection = SqlConn;
// //sqlcmd.ExecuteNonQuery();
// }
// else
// {
// DbClient.Delete<
Asset_Lease
>("LeaseID =" + leaseid);
// DbClient.Delete<
Asset_Service_Contract
>("Contract_AssetID =" + AssetID);
// DbClient.Delete<
Asset
>("AssetID =" + AssetID);
// }
// var orgass1 = (from d in db.Assets join org in db.Peoples on d.Asset_UserID equals org.PeopleID select new { d.AssetID, d.AssetName, d.SerialNumber, d.Asset_UserID, org.ppl_Name, d.Asset_Inactive }).ToList();
// RadGrid1.DataSource = orgass1;
// }
//}
//catch (Exception ex)
//{
// RadGrid1.Controls.Add(new LiteralControl("Unable to delete Id. Reason: " + ex.Message));
// e.Canceled = true;
//}
}
}
#endregion
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AssetsList.aspx.cs" Inherits="TBS_HelpDesk.Views.Assets.AssetsList"
MasterPageFile="~/Views/Shared/MasterPage.Master" EnableEventValidation="false" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:Content
ID
=
"aboutContent"
ContentPlaceHolderID
=
"MainContent"
runat
=
"server"
>
<
telerik:RadCodeBlock
runat
=
"server"
ID
=
"radCodeBlock"
>
<
script
type
=
"text/javascript"
>
function onToolBarClientButtonClicking(sender, args) {
var grid = $find("<%=RadGrid1.ClientID %>");
var comandName = args.get_item().get_commandName();
if (comandName == "Filter") {
if (grid.get_masterTableView().get_isFilterItemVisible()) {
grid.get_masterTableView().hideFilterItem();
}
else {
grid.get_masterTableView().showFilterItem();
}
}
}
function openWin() {
var oWnd = radopen("Dialog1.aspx", "RadWindow1");
}
</
script
>
</
telerik:RadCodeBlock
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"EisDefaultToolBar"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
UpdatePanelHeight
=
""
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
UpdatePanelHeight
=
""
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadToolBar
ID
=
"EisDefaultToolBar"
runat
=
"server"
OnButtonClick
=
"EisDefaultToolBar_ButtonClick"
OnClientButtonClicking
=
"onToolBarClientButtonClicking"
Style
=
"margin-top: 6px;"
Width
=
"100%"
>
<
Items
>
<
telerik:RadToolBarButton
CommandName
=
"InitInsert"
ImageUrl
=
"../../Content/images/AddRecord.gif"
NavigateUrl
=
"Assets.aspx"
Text
=
"Add new"
Visible="<%# !RadGrid1.MasterTableView.IsItemInserted %>">
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
CommandName
=
"LayOut"
onclick
=
"openWin(); return false;"
Text
=
"Add LayOut"
>
</
telerik:RadToolBarButton
>
<
telerik:RadToolBarButton
CommandName
=
"Filter"
ImageUrl
=
"../../images/Filter 3.gif"
Text
=
"Filter"
>
</
telerik:RadToolBarButton
>
<%--<
telerik:RadToolBarButton
CommandName
=
"Show Inactive"
Text
=
"Show Inactive"
>
</
telerik:RadToolBarButton
>--%>
<
telerik:RadToolBarButton
CommandName
=
"RebindGrid"
ImageUrl
=
"../../Content/images/RefreshSelectedRecord.gif"
Text
=
"Refresh"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowFilteringByColumn
=
"true"
AllowPaging
=
"True"
AllowSorting
=
"true"
AutoGenerateColumns
=
"false"
CellPadding
=
"0"
EnableHeaderContextFilterMenu
=
"true"
EnableHeaderContextMenu
=
"true"
GridLines
=
"None"
OnItemCommand
=
"RadGrid1_ItemCommand"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
Skin
=
"Office2007"
EnableViewState
=
"False"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
GroupingEnabled
=
"true"
OnItemCreated
=
"RadGrid1_ItemCreated"
>
<
MasterTableView
HorizontalAlign
=
"NotSet"
IsFilterItemExpanded
=
"false"
EnableViewState
=
"False"
GroupLoadMode
=
"Client"
TableLayout
=
"Fixed"
>
<
ExpandCollapseColumn
Visible
=
"False"
>
<
HeaderStyle
Width
=
"19px"
/>
</
ExpandCollapseColumn
>
<
RowIndicatorColumn
Visible
=
"False"
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
PagerStyle
Mode
=
"NextPrevNumericAndAdvanced"
/>
</
telerik:RadGrid
>
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
ShowContentDuringLoad
=
"false"
VisibleStatusbar
=
"false"
ReloadOnShow
=
"true"
runat
=
"server"
Skin
=
"Web20"
EnableShadow
=
"true"
>
<
Windows
>
<
telerik:RadWindow
Width
=
"350"
ID
=
"RadWindow1"
runat
=
"server"
NavigateUrl
=
"Dialog1.aspx"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
</
asp:Content
>
Mohamed.
I was unable to run the project without your database, so I simplified your site and used fake datasource. It seems that I can get access to the item in ItemCommand. I also added a label that shows when we get properly the text of the
item[
"AssetID"
]
when handling delete command. Here is the modified code:Aspx:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"false"
OnItemCommand
=
"RadGrid1_ItemCommand"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
EnableViewState
=
"False"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
AutoGenerateDeleteColumn
=
"true"
>
<
MasterTableView
EnableViewState
=
"False"
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
PagerStyle
Mode
=
"NextPrevNumericAndAdvanced"
/>
</
telerik:RadGrid
>
<
asp:Label
runat
=
"server"
ID
=
"Label1"
></
asp:Label
>
C#
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
GridBoundColumn boundCol1 =
new
GridBoundColumn();
this
.RadGrid1.MasterTableView.Columns.Add(boundCol1);
boundCol1.HeaderText =
"AssetID"
;
boundCol1.UniqueName =
"AssetID"
;
}
}
protected
void
RadGrid1_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource =
new
int
[] { 1, 2, 3 };
}
int
counter = 0;
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
item[
"AssetID"
].Text = (counter++).ToString();
}
}
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.DeleteCommandName)
{
GridDataItem item = (GridDataItem)e.Item;
string
AssetID = item[
"AssetID"
].Text;
Label1.Text =
"Delete item with AssetID = "
+ AssetID.ToString();
counter = 0;
}
}
Greetings,
Vasil
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

i find another way and finish that work
Thanks ,
Mohamed.