Hi all,
is there a way to allow the selection of text inside a cell if the AllowUpdate is set to false?
If you have AllowUpdate set to False, you will not be able to select the text within the cells. This is because you can't enter edit mode and therefore you cant select anything because by default, the grid will steal the mouse events to process row activation/selection etc. So, the only way to get around this is to disable some javascript events from the grid. Here is the snippet below.
Add this code to your javascript region (change UltraWebGrid1 to the name of your grid) and you will see that you can select all the text as a normal html table. However, this workaround does come with some limitations. Now there will be no concept of an active row or selected cells/rows. Aside from that, this should give you what you want.
Sorry, I missed a some javascript in the previous post.
I added the onmousedown for the element G_UltraWebGrid1 which is the table element for the grid which contains the rows and columns.
The full javascript should be:
window.onload = function() { document.getElementById('UltraWebGrid1_main').onmouseup = null; document.getElementById('G_UltraWebGrid1').onselectstart = null; document.getElementById('G_UltraWebGrid1').onmouseover = null; document.getElementById('G_UltraWebGrid1').onmousedown = null; }
Thank you, Steve.
Karthick,
The way to get the text selection working is to basically take the mouse events away from the grid handling them and just nulling them out. This way, the grid will no longer handle them. Now, this throws a wrench in the gears of this process because the grid needs to know when it was clicked on to actually select the row. So, the only way would be to get both to work would be to re enable the functionality if you want to actually select records. In my sample, I re-route the grid function calls into my own functions. Then, before you make the call to the grid, there can be some check to see if you want to call the normal grid code(row select) or the nullified one where we can select all the text. In my sample, i check a checkbox.
Please take a look at the sample. Hope it helps.
Hi Steve,
Thanks for your reply. I am using UltraWebGrid only and I used the javascript code in the previous post its working. Where the user can select the text and copy by right click on the text. But the another problem is that user is not able to select the row. Is there any solution to solve both problems(text selection and row selection ).
Thanks and Regards
Karthick
Hello Karthick,
Which grid are you using, (UltraWebGrid or WebDataGrid)? This is an older post and the javascript code in the previous posts will only work for the older UltraWebGrid control and will not work for the new WebDataGrid control. Please let me know if yoiu are using the UltraWebGrid or the WebDataGrid so the correct approach can be taken.
Steve
hi,
I am using infragistics grid in my application. Where in any browser user cannot select the text in the columns of the Grid with the mouse and copy the text to the clipboard using ctrl+c or copy by right click using mouse. But I need solution to allow user to select text in grid. So can any one give solution for this.
Thanks in advance
I am having another problem with the WebGrid and wondering if anyone else has experienced the same:
I am trying to set two properties of the grid:
I have tried setting these values using every possible location including in the code behind, the WebGrid designer, in the Ultragrid properties, the Band properties, the Column properties, and the DisplayLayout properties. But none of the changes seem to work at all!
Is there one location of these types of settings which overrides all the others?
--S