Problem:
What should be done to force the Command button to change its content right away, without changing the focus to other cell?
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using Telerik.WinControls.UI;namespace GridApp{ public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); radGridView1.Rows.Add(new object[1] { "zero" }); radGridView1.Rows.Add(new object[1] { "one" }); radGridView1.Rows.Add(new object[1] { "two" }); radGridView1.Rows.Add(new object[1] { "three" }); radGridView1.Rows.Add(new object[1] { "four" }); } private void radGridView1_CommandCellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { switch (e.ColumnIndex) { case 1: RadButtonElement b = (RadButtonElement)((GridCellElement)radGridView1.CurrentCell).Children[0]; b.Tag = true ^ (bool)b.Tag; break; default: break; } } private void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e) { if (e.ColumnIndex == 1) { RadButtonElement b = (RadButtonElement)e.CellElement.Children[0]; b.ImageAlignment = ContentAlignment.MiddleCenter; b.TextAlignment = ContentAlignment.MiddleCenter; // set bool data as switch if (b.Tag == null) b.Tag = false; b.Text = ((bool)b.Tag) ? "locked" : "open"; } } }}
