Telerik Forums
UI for ASP.NET MVC Forum
1 answer
91 views
I have inherited some code to fix what should have been a validation issue. I believe the best fix would be to change the field type in the grid to be a dropdown. At issue is changing the field to a drop down. As seen below, the last developer is creating a grid through JavaScript. This function is called from another JavaScript function which was called from an change event of another grid. Below is the code from the two involved scripts. I have attached a file containing all the other pertinent files to draw conclusions of the functionality that is in place. I want to replace the field "EXPLANATION_CODE" near below with a drop down sourced from a database table but still bounded as it is currently. I would think this should be rather simple but is beyond my current understanding. Also, I am not authorized to change how the grid is currently coded. So I cannot remove it from the function and place it in the view. I can only change the type of the field. Any and all help would be greatly appreciated. If after reviewing the functionality, you see a better way to perform all the required functionality, please forward thoughts. I may be able to refactor later to remove this hideous monstrosity.

/* Following function is in a separate script file and is called from another function */
function SendDocTranInfoToServer(pDocId, pDocSeq) {
    if ($("#kGridExplanations").data("kendoGrid") == null) {
        $("#kGridExplanations").kendoGrid({
            columns: [
                { field: "EXPLANATION_CODE", title: "Code", width: "200px" },
                { command: "destroy" }
            ],
            editable: {
                createAt: "top"
            },
            toolbar: ["create"]
        });

    } else {
        var saveExplanations = "";
        var expGrid = $("#kGridExplanations").data("kendoGrid");
        var expGridDs = $("#kGridExplanations").data("kendoGrid").dataSource;
        var allData = expGridDs.data();

        for (var i = 0; i < allData.length; i++) {
            saveExplanations = saveExplanations + allData[i].EXPLANATION_CODE + "|";
        }
        $.ajax({
            url: "/Inquiry/SetExplanationCodeAndText",
            dataType: "json",
            type: "POST",
            data: { docId: $("#hdPrevDocId").val(), docCount: $("#hdPrevDocCount").val(), expCode: saveExplanations, filingText: $("#tbTextFiling").val() },
            success: function (response) {
            }
        });
        expGrid.dataSource.data([]);
        $("#tbDocCountFiling").val("");
        $("#tbTextFiling").val("");
    }
    $("#hdPrevDocId").val(pDocId);
    $("#hdPrevDocCount").val(pDocSeq);

    var explanationCodes = [];
    $.ajax({
        url: "/Inquiry/GetExplanationCodeByCount",
        dataType: "json",
        type: "POST",
        data: { docId: pDocId, docCount: pDocSeq },
        success: function (response) {
            if (response.hasError) {
            }
            if (!response.hasError) {
                for (var i3 = 0; i3 < response.length; i3++) {
                    var explanationCode = {
                        EXPLANATION_CODE: response[i3].EXPLANATION_CODE,
DOC_COUNT: response[i3].DOC_COUNT,
                    };
                    explanationCodes.push(explanationCode);
                 }  
                 if (explanationCodes.length == 0) {
                     if ($("#kGridExplanations").data("kendoGrid") != null) {
                         $("#kGridExplanations").data("kendoGrid").dataSource.data([]);
                     }
                 } else {
                     var dsExpCode = new kendo.data.DataSource({
                         schema: {
                             model: {
                                 fields: {
                                     EXPLANATION_CODE: { type: "string" },
                                 }
                             },
                             parse: function (response) {
                                 return explanationCodes;
                             }
                        }
                    });

                    if ($("#kGridExplanations").data("kendoGrid") != null) {
                        var grid1 = $("#kGridExplanations").data("kendoGrid");
                        grid1.setDataSource(dsExpCode);
                    }
                }
            }
        }
    });
}
/* Following function from view holding a separate grid and used for the change event */
function kGrdCDocTransChange(arg) {
      var ar = arg;
     var selectedRows = this.select();
     var selectedDataItems = [];
     for (var i1 = 0; i1 < selectedRows.length; i1++) {
         var dataItem = this.dataItem(selectedRows[i1]);
         selectedDataItems.push(dataItem);
     }
     SendDocTranInfoToServer(selectedDataItems[0].DOC_ID, selectedDataItems[0].DOC_COUNT);
 }
Daniel
Telerik team
 answered on 21 Jan 2014
1 answer
74 views
There needs to be a configurable hovertext field for each pager button so that it can be WCAG compliant.
Kiril Nikolov
Telerik team
 answered on 21 Jan 2014
1 answer
973 views
I have this code.  I thought that it would give an ID to the DatePicker.  However, after much debugging, it turns out it changes the name of the parameter which is used on the post.  So the Model Binding was no longer working.

Is this a bug?  I thought that the Name property specified an ID for a control.
@(Html.Kendo().DatePickerFor(m => Model.SearchInfo.StartDate).Name("start-date")

Alexander Popov
Telerik team
 answered on 21 Jan 2014
1 answer
220 views
Does anyone have Grid style issues?

I'm running a local MVC application using IIS express (VS 2012)

Once in a while (seems random) when I refresh the page the grid comes up with no styles (see screenshots)

I'm using the inline editing example with minor changes... not loading any other javascripts...
Dimo
Telerik team
 answered on 21 Jan 2014
3 answers
481 views
I have a Ajax Bound Grid with this column which works:

  
columns.Bound(c => c.Id).Title("")
.ClientTemplate(@Html.ActionLink("Download", "DownloadReport?Id=#=Id#")
.ToHtmlString());
  How do I modify this to show/hide the URL based on c.IsReportAvailable?
Dimiter Madjarov
Telerik team
 answered on 21 Jan 2014
1 answer
488 views

Hi Team,

I am using ImageBrowser as a part of editor widget in my screen . I need to delete an image only if it is not used by other resources. I wired the destroy to an action that checks whether its in use or not. If its in use I would return a message saying it could not be deleted .I got stuck on how to return this message to destroy and stop it from deleting the image from the library.
As the documentation says the configuration values will be sent to jquery.Ajax() function I tried using the success and error functions in the destroy configuration but could not handle the request. It always shows up as undefined.This is how I configured my imagebrowser.

01.imageBrowser: {
02.           path: "/BroadcastType/",
03.           transport: {
04.                read: {
05.                    url: function () { $(".k-breadcrumbs.k-textbox").css('display', 'none'); return "../ImageBrowser/Read" },
06.                    type: "POST"
07.                },
08.                destroy: {
09.                    url: "../ImageBrowser/Destroy",
10.                    type: "POST" ,
11.                    success:function(){},
12.                   error:function(){}
13.                },
14.                thumbnailUrl: "../ImageBrowser/Thumbnail",
15.                uploadUrl: "../ImageBrowser/Upload",
16.                imageUrl: "../ImageBrowser/Image?name={0}"
17.            }
18.        }
In short,
How to stop image from being destroyed from the library until I get a response from backend?
How to handle any errors while backend execution?
Can we override the callback functions in the destroy configuration or should we deal with them at the transport level?

Any pointer to the right direction will be appreciated .

Thanks,
Ramoji.




Dimo
Telerik team
 answered on 21 Jan 2014
1 answer
123 views
Hello,

I'm using a custom filter for my Grid on one specific collumn.
Since a have multiple filters on different collumns I would like to be able to clear the active filter for this single collumn.
I don't want to use dataSource.filter({}); cause this will clear all the active filters.
Could anyone help me with this?
Dimo
Telerik team
 answered on 20 Jan 2014
1 answer
51 views
Hi,
After I closed the ticket # 776594, I found that there is still a problem with your VSIX produced template for MVC 5/VS 2013.  My VS Crashes near the end of the template wizard.  I also saw that the jquery issue is fixed. I have disabled all my add ons & extensions.  Any ideas?

Anthony
Momchil
Telerik team
 answered on 20 Jan 2014
3 answers
658 views
Hi,

I have kendo grid read parameterized method, which search employees. When I as search string with "#" than it does not search. When I debug the code and check searchName value in controller, it was empty. I also checked Json request using IE developer tool, it also remove # values from query string. 

I have pasted my code below. Please guide me.

1. Controller Read Method
01.[HttpPost]
02.public ActionResult ReadEmployee([DataSourceRequest] DataSourceRequest command,string searchName){
03.var empList = GetEmployeeListByFirstAndLastName(searchName)
04.var result = new DataSourceResult
05.           {
06.                Data = empList .FirstName,
07.                Total = empList .LastName
08.            };
09.return Json(result,JsonRequestBehavior.AllowGet);
2. Kendo Grid 
@(Html.Kendo().Grid<EmployeeModel>()
     .Name("Grid")
     .DataSource(dataSource => dataSource
                       .Ajax()
                       .PageSize(20)
                       .Read(read => read.Action("ReadEmployee", "Home", "#"))
 )
      .Columns(columns =>
      {
             columns.FirstName
     })
 
      .Sortable()
      .Scrollable(scrollable => scrollable.Height("auto"))
      .Resizable(resizing => resizing.Columns(true))
      .Pageable(pager =>
      {
          pager.Refresh(true);
          pager.Numeric(true);
      }))

Alexander Popov
Telerik team
 answered on 20 Jan 2014
5 answers
151 views
Hello again!

The restriction works really well for drag & drop, but I'm having troubles with preventing recurring events to overlap. I can do this serverside, but that's not really the friendly way. Anyone got any tips?

// Pär
Vladimir Iliev
Telerik team
 answered on 20 Jan 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?