I want to get both selected Row & UniqueName when grid cell is clicked.

1 Answer 34 Views
Grid
anna
Top achievements
Rank 1
Bronze
Iron
anna asked on 23 Jan 2022, 04:41 PM | edited on 23 Jan 2022, 04:55 PM

In RadGridView, ASP.NET , Web

 

Attached File : ex.png

 

I want to get both selected row and UniqueName when grid cell is clicked.

The source below can only get UniqueName.

 

 void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "customCommand")
        {
            foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns)
            {
                if (column.UniqueName.ToString() == e.CommandArgument.ToString())
                {
                    column.Visible = false;
                }
            }
        }
    }

      function OnColumnDblClick(sender, eventArgs)
            {
                var columnUniqueName = eventArgs.get_gridColumn().get_uniqueName();
                alert(columnUniqueName);
                var oldClass = eventArgs.get_gridColumn().get_element().className;
                eventArgs.get_gridColumn().get_element().className = oldClass + " doubleClickedColumnHeader";
                $find("<%= RadGrid1.ClientID %>").get_masterTableView().fireCommand("customCommand",columnUniqueName);
            }

            function OnColumnClick(sender, eventArgs)
            {
                eventArgs.get_gridColumn().get_element().className = eventArgs.get_gridColumn().get_element().className.replace(" doubleClickedColumnHeader", "");
            }
        </script>

 

 <telerik:RadGrid runat="server" ID="RadGrid1">
            <ClientSettings>
                <ClientEvents OnColumnDblClick="OnColumnDblClick" OnColumnClick="OnColumnClick" />
            </ClientSettings>
        </telerik:RadGrid>

 

Please Help Me. 

I am still waiting for an answer.

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 24 Jan 2022, 06:31 PM

Hello anna,

We would like to kindly ask you to post your questions only once and make sure that the chosen threads are matching the problem faced by you. You can find the answer to the question above in the thread below:

https://www.telerik.com/forums/radgrid-i-want-to-automatically-get-the-coordinates-of-row-and-column-when-the-mouse-cursor-is-placed-on-the-cell-of-radgrid

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
anna
Top achievements
Rank 1
Bronze
Iron
Answers by
Vessy
Telerik team
Share this question
or