Telerik Forums
UI for ASP.NET MVC Forum
3 answers
776 views

can someone help please
my platform is asp.net mvc 5 using razor pages in vs 2019 using telerik latest controls.
in my patient page I have a kendo listivew inside of a kendo TileLayout.
datasource is a list of patient name populating the listivew 
listView generate the listing of items just fine.
however, when I select on the listivew i can not get the current selected item number, 

which will generate an action
no index number, no way to find where to get the selected item.

 

What Am I Doing Wrong.

// index.cshtml

@model ap_GetMembershipListAllRow

<script type="text/x-kendo-template" id="template">
    <div class="patient-view k-widget">             
        <div class="patientidtemp">#:Patient_ID#</div>
        <div class="fullnametemp">#:LastName#, #:FirstName# #:MiddleName#</h1>
        <div class="bdatetemp">Date Begin: #:kendo.toString(BeginDate,"MMM/dd/yyyy")#</div>       
    </div>
</script>

<script type="text/x-kendo-template" id="template2">
    <div class="patient-view k-widget">             
        <div class="patientidtemp1">#:Patient_ID#</div>
        <div class="fullnametemp1">#:LastName#, #:FirstName# #:MiddleName#</h1>
       <div class="bdatetemp1">Date Begin: #:kendo.toString(BeginDate,"MMM/dd/yyyy")#</div>
    </div>
</script>

<script type="text/x-kendo-template" id="patient-list">
    @(Html.Kendo().ListView<ListViewModel>()
        .Name("PatientListView")
        .TagName("div")
        .ClientTemplateId("template")
        .ClientAltTemplateId("template2")       
        .DataSource(dSource => dSource           
           .Ajax()          
           .Read(read => read.Action("PatientList_Read", "PatientPortal").Type(HttpVerbs.Get))
           .PageSize(11)             
          .Model(model => model.Id("Patient_ID"))          
        )
        .Pageable()
        .Selectable(selectable => selectable.Mode(ListViewSelectionMode.Single))
        .Events(events => events.Change("onChange"))
        .ToClientTemplate()
    )    
</script>


//patientportal.js
// nothing works
function onChange(e) {


    var ds = $("#PatientListView").data("kendoListView");
    var index = ds.select().index(),
        dataItem = ds.dataSource.view()[index];

    var item = dataItem;

    var listViewx = $("#PatientListView").data("kendoListView");
    selectItem = listViewx.dataSource.index();
    listView.select(listView.content.children().first());

    var dataSource = listViewx.dataSource.view();
    if (listViewx) {
        $.each(dataSource, function (index, item) {
            if (item.Code === code) {
                listViewx.select(item);
                selectedCoverageCode = item;
            }
        });
    }
    var index = this.select().index();
    dataItem = this.dataSource.view()[index];

   

}

// controller.cs
 public JsonResult PatientList_Read([DataSourceRequest] DataSourceRequest request)
        {
            var result = patientService.GetMembersListItem();     //default list       
            if (ViewData["PatientID"] != null && ViewData["MultiNames"] as string == "Individual")
            {
                string first = ViewData["FirstName"] as string;
                string last = ViewData["LastName"] as string;
                result = patientService.GetPatientSearchNames(last,first );
            }
            return new JsonResult(result.ToDataSourceResult(request));

        }

// patientPortalService.cs
 public List<ListViewModel> GetMembersListItem()
        {
            string connectionString = _configuration.GetConnectionString("ManagerToolsDBContextConnection");
            ap_GetMembershipListAll listAll = new ap_GetMembershipListAll(connectionString);
            listAll.Clinic_id = Convert.ToInt32(_session.GetString("ClinicNumber")); 
            Collection<ap_GetMembershipListAllRow> row = listAll.Execute();

            return GetPatientListViewMapping(row);
        }
        public List<ListViewModel> GetPatientListViewMapping(Collection<ap_GetMembershipListAllNameRow> ap_Get)
        {
            List<ListViewModel> lv = new List<ListViewModel>();
            foreach (ap_GetMembershipListAllNameRow item in ap_Get)
            {
                ListViewModel nlv = new ListViewModel();
                nlv.FirstName = item.FirstName.ToString();
                nlv.MiddleName = item.MiddleName.ToString();
                nlv.LastName = item.LastName.ToString();
                nlv.Patient_ID = (long)item.Patient_id;
                nlv.BeginDate = (DateTime)item.MembershipStartDate;
                lv.Add(nlv);
            }
            return lv;
        }
//ListViewModel.cs

  public class ListViewModel
    { 
        public long Patient_ID { get; set; }
        public string Greeting { get; set; }
        public string FirstName { get; set; }
        [DefaultValue(true)]
        public string MiddleName { get; set; }
        public string LastName { get; set; }
        [DisplayFormat(DataFormatString = "{0:dd-MMM-yyyy}")]
        public DateTime BeginDate { get; set; }
    }

Tsvetomir
Telerik team
 answered on 20 Apr 2021
8 answers
9.9K+ views
Hello,
1.I saw for toolbar a .custom() method.this is not a command?how can i put a custom command,that does something when i click on it?
2.When adding a create command to the toolbar what is the condition to appear in the edited line the update or cancel buttons?

Regads,
Daniel
Anton Mironov
Telerik team
 answered on 19 Apr 2021
2 answers
807 views
Hello - I am using the kendo ui asp.net mvc chat tool to provide a peer to peer chat solution for one of my projects. One of the requirements I have is to keep a log of the messages and then when the chat is initialized load a history of the messages for the last X number of days. I know that when you click on a conversation bubble in the chat box it displays the time the message was posted, but because the messages may span several days, I need a way to display both the date and the time the message was posted. Is there a way to do this? 
Chris
Top achievements
Rank 1
 answered on 17 Apr 2021
1 answer
297 views

Hi guys! I really need your help!

It is necessary to make a dynamic grid with the ability to edit cells. The grid layout appears. Column names are visible. Data is not loaded into the grid. There is an error in the browser console:"Uncaught SyntaxError: unexpected token: numeric literal" kendo.all.js:63353:40. I can’t cope with this error ...

View:

@model System.Data.DataTable
 
@{
    var id = Model.Columns[0].ColumnName;
    var templateName = "String";
}
 
@(Html.Kendo().Grid<dynamic>()
    .Name("Grid")
    .Columns(columns =>
    {
        foreach (System.Data.DataColumn column in Model.Columns)
        {
 
            switch (column.DataType.ToString())
            {
                case "System.Int16":
                case "System.Int32":
                case "System.Int64":
                    templateName = "Integer";
                    break;
                case "System.Decimal":
                case "System.Double":
                case "System.Float":
                    templateName = "Number";
                    break;
                case "System.String":
                    templateName = "NotEditable";
                    break;
            }
 
            if (column.ColumnName == id)
            {
                templateName = "NotEditable";
            }
 
            columns.Bound(column.ColumnName).Title(column.Caption).EditorTemplateName(templateName).EditorViewData(new { name = id });
        }
    })
    .ToolBar(toolbar => {toolbar.Save(); })
    .Editable(ed=>ed.Mode(GridEditMode.InCell))
    .Scrollable()
    .DataSource(dataSource => dataSource.Ajax()
        .Batch(true)
        .Model(model =>
        {
            model.Id(id);
            foreach (System.Data.DataColumn column in Model.Columns)
            {
                var field = model.Field(column.ColumnName, column.DataType);
                if (column.ColumnName == id || column.ColumnName == "BusName")
                {
                    field.Editable(false);
                }
            }
        })
        .Read("Read", "Project")
        .Update("Update", "Project")
    )
    )

Controller:

public ActionResult Index()
        {
            DataTable proj = new DataTable("table");
            proj.Columns.Add()...;
            proj.Rows.Add()
 
            return View(proj);
        }

In debug mode, the Read method does not enter ...

kendo ver. 2018.1.221.545

 

Please tell me what to do. 2 days I can not solve this problem

 

 

Constantin
Top achievements
Rank 1
 answered on 16 Apr 2021
16 answers
771 views
I am getting this error when I open my solution. Removing the Telerik Extensions in VS 2015.3 seems to have resolved it. Similar thread: http://stackoverflow.com/questions/39678601/visual-studio-2015-initializing-part-nuget-packagemanagement-visualstudio-vsolut/41753470?noredirect=1#comment71901895_41753470
Vesko
Telerik team
 answered on 16 Apr 2021
1 answer
75 views
good morning but my TABSTRIP does not page from one tab to another.
Aleksandar
Telerik team
 answered on 16 Apr 2021
5 answers
5.2K+ views

Hi Team,

I am using the Kendo Grid ASP.NET MVC. Please find the column code below. I want to do few things.

1) Edit button is position in the last column for each row having its own. Once the Edit button is being clicked, I want Edit button to be replaced with "Update and Cancel" button.

2) After clicking the edit button, the First column of the whatever row's" Edit" button being clicked will be able to editable by the user. User can type what they wanted to.

3) Once the user clicks on the "Update" button, the first column should be updated (what a user has changed) and become noneditable, and Edit button will replace the "Update and Cancel" button. If user clicks the Cancel button, then the first column would not be updated and Edit button will replace the "Update and Cancel" button. 

4) Grid rows (all data) should remain same as they were before. Refresh function would wipe out the previous data which I do not want it to happen. I want to update a specific row's first column when a user clicks the Edit button of that row. After editing and clicking the update button, the rest of the rows must remain same as they were before.

columns.Bound(p => p.ClickStatus)
        .Title("Action")
        .ClientTemplate("<button type='k-button' class='btn btn-link' id='editComment'>Edit</button>")
        .Groupable(true)
        .Width(120)
        .Locked(false)
        .HtmlAttributes(new { style = "text-align: center;" });

Please guys let me know if you know ways to do it. I have been researching this but not able to succeed. Please get back to me as quickly as possible since I am working on the project. 

 

Best,

Mayur Maisuria

 

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 15 Apr 2021
2 answers
304 views

I am using Telerik MVC. Is there a way to have my own look when using grouping in a dropdownlist.

I would like to have different look in the grouping dropdownlist to sowh the group value on the right for each row in the selectbox. 

Is it a way to do it?

the attached file Current.png is what I have now. the HopeToHave.png is what I was asked to do. 

It seems I can not find any document on how to do it.

The code I have is

 @(Html.Kendo().DropDownListFor(m => m.CompetencyName)
                 DataValueField("CompetencyName")
                .DataTextField("CompetencyName")
                .OptionLabel("Select...")
                .DataSource(source =>  source
                    .Custom()
                    .Group(g => g.Add("CompetencyType", typeof(string)))
                    .Transport(transport => transport
                      .Read(read => read.Action("GetAllCompetencies", "Method", new { posTitle = ViewData["Title"] }).Type(HttpVerbs.Post))
                     )
                )
    )

 

Thanks.

Allen

Allen
Top achievements
Rank 1
Veteran
 answered on 15 Apr 2021
4 answers
147 views

I'm trying to use this basic TabStrip example:

TabStrip Basic Usage

I can see that the first tab for "Paris" is automatically activated by specifying `.Selected(true)`.

I have done similar in my code, and my first tab is automatically activated.

But, nothing happens whenever I select different tabs.

I click Tab 2 and Tab 1 is still showing.

What am I missing?

Douglas
Top achievements
Rank 1
Veteran
 answered on 15 Apr 2021
5 answers
345 views

Hi everyone,

after troubles with Telerik, I tried to re-install the ASP.NET MVC module I have a licence for, the install went well but now I cant create a Telerik app nor upgrade an MVC app. I have also de-installed VS2019 and reinstalled, no more luck.

I get the following error:

An error occurred while running the wizard.

Error executing custom action Telerik.VSX.Actions.UpdateReferencesDataAction: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\username\AppData\Local\Temp\Telerik\ShadowCopy\Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml, Version=2020.2.615.40, Culture=neutral, PublicKeyToken="**the token**"\Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.dll'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
   at System.IO.File.Copy(String sourceFileName, String destFileName)
   at Telerik.VSX.Internal.FileSystem.FileOperator.Copy(String sourceFileName, String destinationFileName)
   at Telerik.VSX.Internal.Assembly.AssemblyLoader.GetShadowCopy(String assemblyPath)
   at Telerik.VSX.Internal.Assembly.AssemblyLoader.ReflectionOnlyLoadFromShadowCopy(String loadInformation)
   at Telerik.VSX.DistributionListing.DistributionItem.GetReferencedAssemblies()
   at Telerik.VSX.DistributionListing.DistributionItem.GetFilteredPrerequisites()
   at Telerik.VSX.DistributionListing.DistributionItem.get_DistributionWidePrerequisites()
   at Telerik.VSX.DistributionListing.DistributionItemList.IntegrityCapableItem.ResetUnmetPrerequisites()
   at Telerik.VSX.DistributionListing.DistributionItemList.Add(IDistributionItem newDistributionItem)
   at Telerik.VSX.DistributionListing.FileBasedDistribution.PopulateItems(DistributionItemList items)
   at Telerik.VSX.DistributionListing.Distribution.get_Items()
   at Telerik.VSX.DistributionListing.ReferencesResolver.Resolve(IEnumerable`1 referencesNames, IDistribution distribution)
   at Telerik.VSX.Actions.UpdateReferencesDataAction.UpdateReferencesData(IPropertyDataDictionary arguments)
   at Telerik.VSX.Actions.UpdateReferencesDataAction.Execute(WizardContext wizardContext, IPropertyDataDictionary arguments)
   at Telerik.VSX.WizardEngine.Actions.ActionBase.Telerik.WizardFramework.IAction.Execute(IWizardContext wizardContext, IPropertyDataDictionary arguments)
   at Telerik.VSX.WizardEngine.ActionManager.ExecActions()

 

I have not been able to find a solution at that time, have you any thought

thanks 

Ray

Nikolay Mishev
Telerik team
 answered on 15 Apr 2021
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
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
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
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?