Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
231 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
221 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
132 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
1 answer
223 views

Hi all,

I'm basically trying to create something similar to the demo presented here:

https://demos.telerik.com/aspnet-ajax/multiselect/virtualization/defaultcs.aspx

I've got a web service as a data source, and everything works (and looks) great without virtualization. I would obviously like to reap the benefits of virtualization, since the multiselect could potentially need to pull in a lot of data.

The issue occurs when I'm trying to select an item:

Telerik.Web.UI.WebRe…1f%3a619d6d01:13732 Uncaught TypeError: Cannot read properties of null (reading 'toJSON')
    at init.select (Telerik.Web.UI.WebRe…3a619d6d01:13732:38)
    at init.trigger (Telerik.Web.UI.WebRe…%3a619d6d01:5322:14)
    at init._select (Telerik.Web.UI.WebRe…%3a619d6d01:13489:7)
    at init._click (Telerik.Web.UI.WebRe…%3a619d6d01:13247:3)
    at init.d (Telerik.Web.UI.WebRe…a619d6d01:2435:3873)
    at init.trigger (Telerik.Web.UI.WebRe…%3a619d6d01:5322:14)
    at init._clickHandler (Telerik.Web.UI.WebRe…3a619d6d01:12931:54)
    at HTMLLIElement.d (Telerik.Web.UI.WebRe…a619d6d01:2435:3873)
    at HTMLUListElement.dispatch (Telerik.Web.UI.WebRe…619d6d01:2436:12445)
    at r.handle (Telerik.Web.UI.WebRe…a619d6d01:2436:9174)

Also, if I try to hook onto the OnSelect client-side event, it seems that the data item is not populated - my function onSelect(sender, args) gets triggered, but args.get_dataItem() returns null. Is it possible some binding didn't go as planned? Is there an extra step that needs to be done when using virtualization, or does perhaps some additional data need to be returned from the web service?

My VirtualSettings look like this:

<VirtualSettings ItemHeight="25" MapValueTo="dataItem" ValueMapper="valueMapper" />

and the ValueMapper isn't to blame because it's not getting triggered; I'm doing a simple scenario where there are no initially selected values to display.

I've tried going through docs for both RadMultiSelect and the Kendo control it wraps, but to no avail. I was initially using a version released in 2022, but have tried just replacing it with 2023.3.1010 - it didn't seem to help. I've also tried explicitly adding the  Virtual="true" option to my RadMultiSelect instance, but that seemed to have no effect either.

Thanks in advance,

Marko

Edit: I've also found the unanswered question regarding the same topic here:
https://www.telerik.com/forums/radmultiselect#1557910

I can't confirm whether the demo works, since it looks like the data source doesn't fetch any data:

Locally, if I basically copy/paste it and implement the web service, without virtualization everything works, when I add the VirtualSettings node, I'm getting the aforementioned error (probably caused by the fact that dateitem is actually null). I've also tried binding initial values, and they get displayed properly in the multiselect and can be deselected without issues.
branko
Top achievements
Rank 1
Iron
 answered on 15 Nov 2023
0 answers
106 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
93 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
0 answers
268 views

Validator text shows as required, however the message on the validator doesn't show in the asp:ValidationSummary control.

 

RBarnes
Top achievements
Rank 1
 asked on 08 Nov 2023
1 answer
95 views

Hi,

How to disable zooming?

Regards,

Omar

Vasko
Telerik team
 answered on 06 Nov 2023
1 answer
103 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
0 answers
91 views

When initializing a RadScheduler control on a mobile browser (examples are iOS Safari and Android Edge), the javascript plugins code crashes when trying to call `add_hiding` (assuming an event handler).

On the mobile browser, the issue isn't present when to toggle `View Desktop Site`.

From the error stack trace, the second line for `Plugin.js` points to:

Which looks like there's some handling to make context menus work on mobile device.

Any clues as to why `add_hiding` fails on mobile view?

Chris
Top achievements
Rank 1
Iron
 asked on 06 Nov 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?