Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
27 views

When using RadGrid, if setting UseStaticHeaders="True", in rendered HTML, the table header will be rendered into a separate table, and we will get the following complaints from Siteimprove Accessibility Checker:

  • No data cells assigned to table header
  • Table cell missing context

Is there a solution to this issue?

Sheng
Top achievements
Rank 1
Iron
Iron
 asked on 28 Nov 2023
0 answers
40 views

Hello,

I made an update to the newest Telerik.Web.UI Version 2023.3.1010.45 and now I cannot collapse my RadGrid-Items anymore after expanding.  Instead I can see a statusbar which is loading infinite long on the left side when the ViewState is enabled in the Sitefinity Backend. When I disable the ViewState I have the same problem, just without statusbar. There is a screenshot of the grid and my HTML-Code in the attachment. Could anybody help me?

Regards

 

Uwe
Top achievements
Rank 1
 asked on 28 Nov 2023
1 answer
28 views

Hello,

How do I check if row is selected from the snippet below?

function BatchEditOpening(sender, args) {
    var row = args.get_row();
    var cell = args.get_cell();
    var tableView = args.get_tableView();
    var column = args.get_column();
    var columnUniqueName = args.get_columnUniqueName();
    var isCanceled = args.get_cancel();
}

I tried 

row.get_selected() but it throws an exception.  Please advise.

 

 

Vasko
Telerik team
 answered on 24 Nov 2023
1 answer
71 views

Hello,

I have a grid with

EditMode='Batch' 
<BatchEditingSettings EditType="Cell" OpenEditingEvent="DblClick"/>

When I double-click on the cell it (the cell) goes into edit mode which is expected behavior, however I need to achieve the same result by pressing another button located on the same page as grid.

Following code puts entire row into edit mode, but I wonder is there a method to invoke for editing single cell only.

masterTable.editItem(masterTable.get_selectedItems()[0].get_element());
Please advise.
Vasko
Telerik team
 answered on 22 Nov 2023
1 answer
68 views

I have a Weight column in my RadGrid, which I'm using a CustomValidationFunction, which is working fine. It disallows invalid values.

But I want blank, 0 (or below) to be set automatically to the minimum value allowed, rather than making the user put it in manually. How can I accomplish this?

 

Here is the column I'm validating:

                                <telerik:GridTemplateColumn UniqueName="Weight" HeaderText="Weight" DataField="Weight" AllowFiltering="false">
                                    <ItemTemplate><%# Eval("Weight") %></ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="WeightAmt" runat="server" />
                                        <asp:CustomValidator runat="server" ID="WeightValidator" EnableClientScript="true" ControlToValidate="WeightAmt"
                                            ClientValidationFunction="WeightValidator" />
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
And here is the validation function as it currently stands:

        function WeightValidator(sender, args) {
            var thisWeight = parseInt(args.Value);
            if (thisWeight > maxWeight) {
                sender.textContent = "Weight may not be larger than " + maxWeight;
                args.IsValid = false;
                return;
            }
            if (thisWeight < 1) {
                thisWeight = minWeight;
                arguments[0].parentElement.parentElement.getElementsByTagName("input")[0].textContent = minWeight.toString();
            }
            if (thisWeight < minWeight) {
                sender.textContent = "Weight may not be smaller than " + minWeight;
                args.IsValid = false;
                return;
            }
            args.IsValid = true;
        }
Debug indicates the `arguments` statement sets the value, but this isn't actually tied to anything on the page, so it gets lost. The only place I see the cell value is in a hidden `div` (`style="display: none")` and I don't see any way of changing that.

In searching for a solution, I see it is recommended to edit the `innerHTML`, but that doesn't even contain the value I'm wanting to edit.

Is there a good way for validation to correct data errors that it can instead of just calling it invalid?

Vasko
Telerik team
 answered on 16 Nov 2023
1 answer
46 views

Hi

I have an application that had a telerik Rad Grid, with filtering enabled.

The application can be opened via another application, passing filters to the first 2 columns like below. However when passing the filters like this the rows are not reflecting what is in the filter. If I was to manually enter the value in the filter it will work.

 

I have this in my code for ItemDatabound

 protected void rg_CallDetails_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (!string.IsNullOrEmpty(department))
                {
                    rg_CallDetails.MasterTableView.FilterExpression = "([Department] " + "LIKE " + "\'%" + department + "%\' AND [CallNumber] " + "LIKE " + "\'" + callTypePre + "%\' ) ";
                    GridColumn column = rg_CallDetails.MasterTableView.GetColumnSafe("Department");
                    column.CurrentFilterFunction = GridKnownFunction.Contains;
                    column.CurrentFilterValue = department;


                    //rg_CallDetails.MasterTableView.FilterExpression = "([CallNumber] " + "LIKE " + "\'" + callTypePre + "%\') ";
                    GridColumn columnCallType = rg_CallDetails.MasterTableView.GetColumnSafe("CallNumber");
                    columnCallType.CurrentFilterFunction = GridKnownFunction.Contains;
                    columnCallType.CurrentFilterValue = callTypePre;

                    rg_CallDetails.MasterTableView.Rebind();

                }
            }

        }

But the application errors with stackoverflow exception error on the rebind.

I have tried rg_CallDetails.Rebind()

But also gives the same error.

Any advise please?

Thanks

 

                                       
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 15 Nov 2023
0 answers
30 views

Hi 

I have radgrid for an application that has the filters set to show.

When the page first loads and grid is populated the filter works successfully, however if I do anything like click on another button so the page reloads for example, the filters stop working. So when I click on the filter button the drop down of options does not show anymore.

Any advise on why its behaving like this please?

Thanks

Rakhee

Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
 updated question on 15 Nov 2023
1 answer
45 views

I have a RadGrid using BatchEdit mode. The automated validation is working fine, but I want to program in an exception: blank values are not allowed for fields, but the database is full of records with existing blank values. I want the validation to accept a blank value if the existing record already has a blank value.

Here is my validation method. Note that the attribute OriginalValue doesn't exist; it's part of my trying to find the original value, but adding it turned out to be problematic.

        function BlankFieldValidator(sender, args) {
            if (args.Value.length == 0) {
                if (sender.getAttribute("OriginalValue").length != 0) {
                    args.IsValid = false;
                }
            }
        }

In debugging the page, I can examine the sender and args objects, but I see nothing that contains the original value in it. I conclude it must be in the Telerik data structure somewhere, since one can still click Cancel Changes to revert all changes to the RadGrid.

What is a good method for retrieving the original value to compare to the edited value?

Vasko
Telerik team
 answered on 14 Nov 2023
1 answer
34 views

 

Sometimes i have unwanted suggestions in a grid on entry (like 11,122 in attached pic).

Is there a way to eliminate this?

 

 

 

Vasko
Telerik team
 answered on 06 Nov 2023
1 answer
71 views

Hi,

I would like to get the selected row index for the grouped grid. Can anyone help me with this?

 


<telerik:RadGrid ID="Grid_logic" runat="server" AutoGenerateColumns="false" Font-Size="Small" Width="600px" Skin="Default" ShowGroupPanel="false" OnSelectedIndexChanged="Grid_logic_SelectedIndexChanged">
    <GroupingSettings CollapseAllTooltip="Collapse all groups"  />
       <MasterTableView ClientDataKeyNames="logicID"  DataKeyNames="logicID"  ShowGroupFooter="false" ShowHeader="false" GroupsDefaultExpanded="true" GroupLoadMode="Client">
          <Columns>
                                                    
            <telerik:GridBoundColumn DataField="logicID" FilterControlAltText="Filter column column" HeaderText="" UniqueName="logicID"  Visible="true" >
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Answer" FilterControlAltText="Filter column column" HeaderText="Answer" UniqueName="Answer">
            </telerik:GridBoundColumn>
           <telerik:GridBoundColumn DataField="IncludedPages" FilterControlAltText="Filter column column" HeaderText="Included Pages" UniqueName="IncludedPages">
           </telerik:GridBoundColumn>
        </Columns>

         <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                     <telerik:GridGroupByField FieldAlias="Answer" FieldName="Answer" HeaderText="" />
                     <telerik:GridGroupByField FieldName="IncludedPages" HeaderText="IncludedPages" />
                </SelectFields>
      <GroupByFields>
        <telerik:GridGroupByField FieldAlias="Page" FieldName="Page" FormatString="" HeaderText="" />
       <telerik:GridGroupByField FieldAlias="Question" FieldName="Question" FormatString="" HeaderText="" />
     </GroupByFields>
  </telerik:GridGroupByExpression>
 </GroupByExpressions>
 <GroupHeaderTemplate>
    <table>
        <tr style="width: 100%">
        <td style="vertical-align: central">
        <asp:Label ID="Page" runat="server" Text='<%# Eval("Page") %>' ></asp:Label>
       </td>
     <td style="vertical-align: central">
     <asp:Label ID="Question" runat="server" Text='<%# Eval("Question") %>'></asp:Label>
      </td>
    </tr>
  </table>
  </GroupHeaderTemplate>
 </MasterTableView>
                                            
 <ClientSettings AllowDragToGroup="true" >
 <Selecting AllowRowSelect="true"></Selecting>
 <ClientEvents OnRowContextMenu="RowContextMenu" />
 </ClientSettings>
</telerik:RadGrid>

 

An example of my field attempts.


protected void Grid_logic_SelectedIndexChanged(object sender, EventArgs e)
        {
            int x = Grid_logic.SelectedItems.Count;
            if (Grid_logic.SelectedItems.Count > 0 && Grid_logic.SelectedItems[0].OwnerTableView.DataKeyValues.Count > 0)
            {
                var z = Grid_logic.SelectedItems[0].OwnerTableView.DataKeyValues[Grid_logic.SelectedItems[0].ItemIndex]["logicID"];
            }
        }

Thanks,

 

Attila Antal
Telerik team
 updated answer on 01 Nov 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?