I have a radgrid with a checkbox column and textbox column as follows:
The textboxtemplate is as follows:
When I click on the textbox, I want the row to be automatically selected. How can I achieve this?
Also after selections are made, and i click on a row, all selections are disabled. I want to change this behaviour also. Deselect only happens when I click on the checkbox.
this._RadGrid1.AllowFilteringByColumn = true; this._RadGrid1.AllowSorting = true; this._RadGrid1.MasterTableView.AllowNaturalSort = true; this._RadGrid1.MasterTableView.DataKeyNames = new string[] { this._PriceDealProductBanTable.PriceDealEntityProductItemIdColumn.ColumnName }; this._RadGrid1.MasterTableView.ClientDataKeyNames = new string[] { this._PriceDealProductBanTable.PriceDealEntityProductItemIdColumn.ColumnName }; this._RadGrid1.EnableLinqExpressions = false; this._RadGrid1.MasterTableView.NoMasterRecordsText = "No Products found."; this._RadGrid1.MasterTableView.Width = Unit.Percentage(100); this._RadGrid1.ClientSettings.Selecting.AllowRowSelect = true; this._RadGrid1.AllowMultiRowSelection = true; this._RadGrid1.NeedDataSource += RadGrid1_NeedDataSource; this._RadGrid1.ItemDataBound += RadGrid1_ItemDataBound; GridBoundColumn boundColumn = new GridBoundColumn(); string columnName; #region RadGrid Columns GridClientSelectColumn selectAll = new GridClientSelectColumn(); selectAll.UniqueName = "SelectOne"; this._RadGrid1.MasterTableView.Columns.Add(selectAll);//Other columns templateColumn = new GridTemplateColumn(); templateColumnName = this._PriceDealProductBanTable.BillingAccountNumberColumn.ColumnName; this._RadGrid1.MasterTableView.Columns.Add(templateColumn); templateColumn.DataField = templateColumnName; templateColumn.ItemTemplate = new TextBoxTemplate(templateColumnName); templateColumn.HeaderText = "BAN"; templateColumn.UniqueName = "BAN"; templateColumn.AllowFiltering = false; The textboxtemplate is as follows:
public class TextBoxTemplate : ITemplate { protected RadTextBox _textBox; string _columnName; public TextBoxTemplate(string columnName) { this._columnName = columnName; } public void InstantiateIn(System.Web.UI.Control container) { this._textBox = new RadTextBox(); this._textBox.ID = this._columnName; container.Controls.Add(this._textBox); this._textBox.DataBinding += new EventHandler(_textBox_DataBinding); } void _textBox_DataBinding(object sender, EventArgs e) { RadTextBox txt = (RadTextBox)sender; GridDataItem container = (GridDataItem)txt.NamingContainer; txt.Text = ((DataRowView)container.DataItem)[this._columnName].ToString(); } }When I click on the textbox, I want the row to be automatically selected. How can I achieve this?
Also after selections are made, and i click on a row, all selections are disabled. I want to change this behaviour also. Deselect only happens when I click on the checkbox.