Hi,
i am facing following problem with RadGrid if i am using ClientEvents-OnCommand.
the problem is if i am adding ClientEvents-OnCommand in radgrid, it does fire itemcomamnd event of grid for user defined command,
but it always points to the first item in radgrid (e.Item) .
.ascx
.cs
protected void Page_Load(object sender, EventArgs e)
{
this.RadGrid1.ItemCommand += OnItemCommand;
this.RadGrid1.ClientSettings.ClientEvents.OnCommand = "OnCommand";
}
var id = new Guid(item["Id"].Text);
... etc
if i remove ClientEvents-OnCommand, it works fine.
am i doing anything wrong ?
i am facing following problem with RadGrid if i am using ClientEvents-OnCommand.
the problem is if i am adding ClientEvents-OnCommand in radgrid, it does fire itemcomamnd event of grid for user defined command,
but it always points to the first item in radgrid (e.Item) .
.ascx
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function OnCommand(sender, args) {
// it is doing nothing
}
</script>
</telerik:RadCodeBlock>
.cs
protected void Page_Load(object sender, EventArgs e)
{
this.RadGrid1.ItemCommand += OnItemCommand;
this.RadGrid1.ClientSettings.ClientEvents.OnCommand = "OnCommand";
}
void OnItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.Item == null)
return;
switch (e.CommandName)
{
// user defined
case "Standard":
GridDataItem item = (GridDataItem)e.Item;
// e.g id is always Id of the first item in radgrid if ClientEvents-OnCommand is definedvar id = new Guid(item["Id"].Text);
... etc
if i remove ClientEvents-OnCommand, it works fine.
am i doing anything wrong ?