This is a migrated thread and some comments may be shown as answers.

Need the value of cell of the row on which user double click on RadGrid

5 Answers 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Himanshu
Top achievements
Rank 1
Himanshu asked on 06 Sep 2013, 07:46 AM
In our application we have functionality that when user double click on any row of Rad-grid then that row become in editable mode. so now we have requirement that when user double click on a specific column of that row then after coming in editable mode that control must be auto focused.
So i need the value of cell on which it is double clicked to set the focus on that control when that row comes in editable mode. So is there any event of Rad-grid which provides this functionality.

Any suggestion will be helpful.

In my attached image if i double click on row's RateType column then the RateType Drop Down which comes in editable mode must be auto focused.

5 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 11 Sep 2013, 09:33 AM
Hi Himanshu,

Such functionality is not available out of the box and its implementation highly depends on the scenario (in some scenarios it could not be possible).

Since you are using the grid's "OnRowDblClick" client-side event for start editing, I could suggest you to retrieve the column index with the following:
function rowDblClick(sender, args) {
      var columnIndex = args.get_domEvent().target.cellIndex;
      .....
*Note that this may not work in every scenario.

One possible approach to set the focus to the column editor control could be to to save the column index in "HiddenField" control for an example and retrieve it on the ItemDataBound server-side event of the grid. There you could access the column editor and use the Focus() method of the control. In some scenarios you may have to get the edit control ClientID, send it to the client and set the focus there (here you could find one possible approach for getting ClientID and send it to the client).

Additionally, please take a look at the following help article that could be of use in your scenario: "Focus the Textboxes in the Edit Control"

 

Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Himanshu
Top achievements
Rank 1
answered on 12 Sep 2013, 07:23 AM
Hi Konstantin Dikov,
Thanks for your  reply which is really helpful for us.
We have already tried to get the value by cellIndex property but for various control it is not giving this property in this order but inside the document element which will be very unpredictable. This is completely independent whether it is Drop Down, Text-box, enabled, disabled.

Should i consider this as a technical limitation?

Regards,
Himanshu Goel
0
Konstantin Dikov
Telerik team
answered on 17 Sep 2013, 08:25 AM
Hello Himanshu,

As you have observed out yourself, this approach will highly depend on the controls that are used within the grid. As was mentioned in my first post, the given solution could not work in every scenario and for different controls/elements a different one should be used.

Since such functionality could be achieved in practice, I could not say that this is a technical limitation, but indeed it will need a custom solution for different RadGrid structures.

If you however decide to implement this functionality and you encounter any difficulties along the way, please don`t hesitate to get back to us.


Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Himanshu
Top achievements
Rank 1
answered on 18 Sep 2013, 12:42 PM
Hi Konstantin Dikov,
I have tried the custom solution for this issue as i mentinoed earlier that i was using the cellIndex() but i also tried the ID property which is also giving me the blank value for some controls.
So can you please provide me a demo regarding to this for a Rad telerik grid which contains several controls like drop down, text box in disabled/enabled/ read only mode behavior will be really helpful.

Regards,
Himanshu Goel
0
Konstantin Dikov
Telerik team
answered on 23 Sep 2013, 10:30 AM
Hi Himanshu,

I have prepared a sample project with the desired functionality.

As you will notice, cell selection is enabled and the "OnCellSelection" client side event is used to retrieve the cell column "UniqueName" and row index and those client setting should be used:
<ClientSettings>
    <Selecting CellSelectionMode="SingleCell" />
    <ClientEvents OnRowDblClick="rowDblClick" OnCellSelected="cellSelected"/>
</ClientSettings>

Please test the attached project and see if it fulfills your requirements. Please note that the used approach will need further modifications if "TemplateColumn" is used and in the "ItemCreated" server side event handler, the Focus() method should be used for the "TemplateColumn" edit control. For every other grid column, the provided approach will do the trick.

Hope that helps.

 

Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Himanshu
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Himanshu
Top achievements
Rank 1
Share this question
or