15 Answers, 1 is accepted
You should use the editor events. Here is an example:
I hope this will be useful. Let me know if you have additional questions.
Thank you Dimitar, This was so helpfull.
I need the same for GridViewComboBoxColumn instead of GridViewTextBoxColumn
Here is the code for GridViewComboBoxColumn:
Do not hesitate to contact us if you have other questions.
Thank you show much, Its working fine....
How we get value of typed text in TextBoxItem_KeyPress event
Here is the code for getting the text:
Let me know if I can assist you further.
Now I am getting value of my typed text..
I wanna search name in my db by using that typed text and bind in same column(GridViewComboBoxColumn)
I am trying like this
private void TextBoxItem_KeyDown(object sender, KeyEventArgs e)
var textBoxItem = sender as RadTextBoxItem;
var text = textBoxItem.Text;
Datatable dt = new DataTable();
string sql = "select firstname from Namemaster where firstname like '%" + text + "%' or lastname like '%" + text + "%' or middlename like '%" + text + "%'";
dt = objdl.getDataTable(sql);
GridViewComboBoxColumn comboboxcolumn = (radGV.Columns["Combo"] as GridViewComboBoxColumn);
comboboxcolumn.DataSource = dt;
public DataTable getDataTable(string str)
sqlcom = new SqlCommand(str, con);
sqlcom.CommandTimeout = 300;
dr = sqlcom.ExecuteReader();
dt = new DataTable();
But it will not working properly
I want to display firstname only in my GridViewComboBoxColumn if i searching with lastname and middlename.
while searching with firstname everything is fine, i need the same result for lastname and middlename.
Actually me need is..
I hava RadGridView with GridViewComboBoxColumn with AutoComplete, while i am searching in GridViewComboBoxColumn i want to check in my table with firstname,lastname and midlename with typed text and bind firstname only in my GridViewComboBoxColumn
I need a solution for this...
This can be achieved by using GridViewMultiComboBoxColumn and setting the AutoFilter functionality to use composite filter: Filtering | RadMultiColumnComboBox.
You can use the same approach from the previous posts and access the editor in the CellEditorInitialized event handler and set its properties there.
I hope this will be useful.
I have RadGridview with GridViewTextBoxColumn and I have some value in my GridViewTextBoxColumn then i want to assign again value in GridViewTextBoxColumn
my code is
radGV.Rows[radGV.CurrentCell.RowIndex].Cells["Colname"].Value = "aaaaa";
But its throw exception
Object reference not set to an instance of object
You need to check if the CurrentCell is null, and it would be better to set the value without using indexes. Here is an example:
I hope this will be useful.
Thank you so much Dimitar, now its working fine.I have done my work...
The Tab key is handled by the grid and it is not forwarded to the text box. To handle the Tab key you need a custom GridDataRowBehavior. Here is an example:
I hope this helps. Should you have any other questions, do not hesitate to ask.
Thanks Dimitar for the reply.
Actually i have a grid having GridViewComboBoxColumn Column. Below is the code how i added combo box column.
Now when i filter product in the combo box e.g i filter product "Keyboard" by typing "Key" and Keyboard is selected, but if i press the "Enter" key then product is actually selected and if i press "Tab" key the filtered product disappear. Is it possible that i press "Tab" key and get functionality of "Enter" key?
I have tested this and it works fine on my side (see attached). Am I testing wrong? Which version of the suite are you using?
I am looking forward to your reply.