RadGrid

0 Answers 92 Views
Grid
anna
Top achievements
Rank 1
Bronze
Iron
anna asked on 07 Feb 2022, 11:57 AM

<ClientSettings EnablePostBackOnRowClick = "true">
<Selecting CellSelectionMode="MultiCell" />
<ClientEvents OnCellSelected="cellSelected" />

 

function cellSelected(sender, args) {
            var selectedRow = args.get_row();
            var selectedColumn = args.get_column();
            var dataItem = args.get_gridDataItem();
            var tableView = args.get_tableView();
            var cellIndex = args.get_cellIndexHierarchical();
     
            var output = String.format("Row:" + dataItem.get_itemIndexHierarchical() + ",Col:" + selectedColumn.get_uniqueName());

           alert(output); <============= I want to delete(alert(output);
However, if I clear alert(output); , gv_ItemConmmand is not called.


            sender.get_masterTableView().fireCommand("cellSelected", output);
        }

 

  protected void gv_ItemConmmand(object source, GridCommandEventArgs e)
        {          
            if (e.CommandName == "cellSelected")
            {
                gvDetail.CurrentPageIndex = 0;
                gvDetail.Rebind();

                var clickedColumnName = e.CommandArgument.ToString();
            }
        }

 

Doncho
Telerik team
commented on 10 Feb 2022, 11:02 AM

Hi Anna,

One thing you can try is to wrap the fireCommand call inside a setTimeout() function so it gets called right after the cellSelected event listener execution:

setTimeout(function() {  sender.get_masterTableView().fireCommand("cellSelected", output);})
If this is not helping we would need a reproduction of the problem so we can investigate it locally. Sharing the complete ASPX page containing the RadGrid will help us understand better the current scenario.

anna
Top achievements
Rank 1
Bronze
Iron
commented on 10 Feb 2022, 01:43 PM | edited

Hello.

Attacted File : Res27.aspx, Res27.aspx.cs

I wrote the code as you taught me. 

But, I wrote the code as you taught, But it doesn't work.

I have attached the file in question.

 

Question 1 ) Click the link below.

In RadGrid, BackColor Of Selected Cell in UI for ASP.NET AJAX | Telerik Forums

I wrote the code as you taught me.
However, if I write the code as you taught, it doesn't work.
Please check the attached files Res27.aspx and Res27.aspx.cs to see what the problem is.
In Res27.aspx, The code below is written.
html body .RadGrid .pinkCell{
        background-image:none;
        background-color: lightpink;
    }
In Res27.aspx.cs, The code below is written.
item.CssClass = "pinkCell";

 

Question 2) Please check the attached file (Res27.aspx, Res27.aspx.cs)

setTimeout(function() {  sender.get_masterTableView().fireCommand("cellSelected", output);})

In Attached file Res27.aspx, There is function cellSelected(sender, args).

In Attached file Res27.aspx.cs , There is if (e.CommandName == "cellSelected").

Please check the attached file Res27.aspx , Res27.aspx.cs.

 

Question 3) Click the link below.

Gap between Radgrid and RadTextbox in UI for ASP.NET AJAX | Telerik Forums

There is a gap between the Radgrid and RadTextbox.

I want there to be no gap between the grid and the box.

In Attached file Res27.aspx , There is 

<telerik:GridTemplateColumn DataField="D0_T1" HeaderText="1T"  Visible="true" ColumnGroupName="D0">
                                        <HeaderStyle Width="65px" CssClass="main_column_header2"  HorizontalAlign="Center" VerticalAlign="Middle" Font-Size="11px"/>
                                 <ItemStyle Width="65px"  CssClass="rgAltRow" HorizontalAlign="Center" VerticalAlign="Middle" Height="22px" BackColor="White" />
                                        <ItemTemplate> 
                                            <telerik:RadTextBox ID="D0_T1" runat="server" Text='<%#Bind("D0_T1")%>' MaxLength="4" Style="text-align: center" Width="60px" ></telerik:RadTextBox> 
    </ItemTemplate>
                                    </telerik:GridTemplateColumn>

 

 

Still not resolved.
Telerik is so inconvenient.
keep waiting for an answer.

 

Doncho
Telerik team
commented on 11 Feb 2022, 01:55 PM

Hi Anna,

I would suggest we proceed with the communication about each separate issue in the specific thread you have opened for each one of them.

To your questions:

1) Please try setting the additional CssClass either in the ItemDataBound event (as I have suggested here -  link) or in the RadGrid's PreRender event. The NeedDataSource event is too early to get and process the Text of RadGrid's cells. Let me know the result of testing this in the other thread you have opened particularly for this issue.

2) Please clarify what is the behavior when adding the setTimeout() function.
Is there any error thrown?

  • Please make sure there are no JavaScript errors on the page, check out how in the Troubleshooting JavaScript errors section.
  • Try to remove any Ajax settings on the page (set EnableAJAX property of the RadAjaxManager to false) and test the behavior that way, while monitoring the Console for JavaScript errors again. Find more about this troubleshooting approach here - Get more descriptive errors by disabling AJAX

 3) I have sent a message in the thread you have opened specifically for this issue.

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
anna
Top achievements
Rank 1
Bronze
Iron
Share this question
or