Telerik Forums
UI for ASP.NET MVC Forum
24 answers
5.6K+ views
Hi All,

I have a Kendo grid which Displays data based on filter criteria in TextBox above clicking search button. The grid has edit and Detail Action links which take user to a different view (no popup or inline),  loading more fields than we Display in grid for edit.When done editing and user Comes back to grid it must retain old filter criteria, selected record, page etc. Which is the best way to achieve this using Kendo grid?

Anamika
Dimo
Telerik team
 answered on 26 Jan 2017
2 answers
1.2K+ views

Hi,

I'd like my text column to recognise line breaks. I've seen this post:

http://www.telerik.com/forums/line-breaks-in-grid-data

but I'm displaying the column using the following format:

columns.Bound(c => c.NoteContent).Title("Note").Width(300);

How would I modify the content so that it replaces '\n' with '<br>'?

Thanks

Tim

Danny
Top achievements
Rank 1
 answered on 26 Jan 2017
1 answer
70 views

In my application I have a search function that uses additional parameters passed into the datasource, which works great!  However, after getting results and clicking into one, and then going Back in the browser and searching again, I get the following error :

 

Uncaught TypeError: Cannot read property 'dataSource' of undefined

Any ideas?

Niko
Telerik team
 answered on 26 Jan 2017
2 answers
154 views

Hello,

currently I have a trial version of UI for ASP.NET MVC and I am working on a test web application. My goal is to design a simple page with an editor widget on it. I would like to integrate into the toolbar several dropdownlists (about 5). The dropdownlist should work similarly to the 'insert html' snippet.

For that purpose I would:

1. need customer labels/titles for the dropdownlists

2. need to use a remote datasource (table form an azure sql db) to populate the dropdownlists

3. need an event that places the selected item of the dropdownlist into the editor box at the cursor position

I studied the documentation for the editor widget but was not able find out wether my goal can be realized.

If someone could give me advice about the feasibiltiy of and how to realize my goal.

Thanks in advance.

Manfred

 

 

 

Manu
Top achievements
Rank 1
 answered on 25 Jan 2017
1 answer
372 views
I've noticed that if I have a kendo combobox with server filtering enabled, if I call the open event in jquery, it will fire a read event (go to the server and get results) and then open the list with the results.  However, it doesn't always fire the read event so sometimes it doesn't update.  When i call the read event, it doesn't open the list with the results.  Is there anyway that i can call the read event, then make the combobox list dropdown and show the results?  I'm trying to call the read event then the open event, without the open calling the read event again.  
Peter Milchev
Telerik team
 answered on 25 Jan 2017
1 answer
7.5K+ views

Hi Team,

When I try to use 

 $(document).ready(function () {
                $("#grid2").data("kendoGrid").dataSource.filter({ logic: "and", filters: [{ field: "Title", operator: "contains", value: "nurse" }] })
    });

I got an error of "Cannot read property 'dataSource' of undefined at HTMLDocument.eval".

The following is my grid:

@(Html.Kendo().Grid(Model)
        .Name("grid2")
        .Columns(columns =>
        {
            columns.Command(command => command.Custom("Add").Click("AddToTeam")).Width(40);
            columns.Bound(p => p.StaffItem.FullName).Title("Name").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
            columns.Bound(p => p.StaffItem.JobTitleDesc).Title("Title").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));


        })
        .Pageable()
        .Sortable()
        .Filterable(ftb=>ftb
            .Extra(false)
            .Operators(operators => operators
                .ForString(str => str.Clear()
                 .Contains("Contains")
                    .IsEqualTo("Is equal to")
                    .IsNotEqualTo("Is not equal to")
        )))
        .DataSource(d => d
            .Ajax()
            //.Filter(f=>f.Add(a=>a.StaffItem.JobTitleDesc).Contains("nurse"))
            .ServerOperation(false)
            .PageSize(8)
        )
        .Resizable(resize => resize.Columns(true))
        .Reorderable(reorder => reorder.Columns(true))
    )

Eyup
Telerik team
 answered on 25 Jan 2017
1 answer
510 views

I have a tree View with hierarchical data source which is located left side of the screen. The size of hierarchical data source is not known and it can overflow the page.

I want to scroll only treeView(not the whole page) and I can do it like that:

#treeView{

overflow-y: scroll;

height: 800px;

}

.html{

overflow: hidden;

}

 

However my code will be run several devices and I do not want to give a division static height. Is there a way to give height to a division after doing some calculations?

Magdalena
Telerik team
 answered on 25 Jan 2017
3 answers
861 views
Hi Kendo Team,
I have a grid with multiple child grids. I'm having troubles trying to do checkbox selection for the grid and its child grids with the requirements: selecting one record from parent grid should select all records of its child grid and select one record of the child grid should select its parent record accordingly.
The main grid:
@(Html.Kendo().Grid<PendDetailRecordDTO>()
        .Name("pendDetailRecord_grid")
        .Columns(columns =>
        {
        columns.Bound(c => c.DetailRecord.ID).HeaderTemplate(@<input type="checkbox" id="selectAll" />)
            .ClientTemplate(@"
                                # if (StatusText=='Failed') { #
                                <input type=""checkbox"" class=""app_select"" data-refid='#: DetailRecord.ID #'/>
                                # } #
                        ").Sortable(false).Width(20);
            columns.Bound(c => c.DetailRecord.StorageLoc).Title("Storage Location").Width(105);
            columns.Bound(c => c.StorageLocationText).Title("Store Name").Sortable(false).Width(105);
            columns.Bound(c => c.DetailRecord.MainMaterialNo).Title("Main Stockcode").Sortable(true).Width(95);
            columns.Bound(c => c.DetailRecord.Qty).Title("Qty").Sortable(true).Width(35);
            columns.Bound(c => c.DetailRecord.ErrMsg).Title("Error Message").Sortable(false);
            columns.Bound(c => c.StatusText).Title("Status").Sortable(false).Width(55);
            columns.Bound(c => c.DocNo).Title("Doc No").Sortable(false).Width(75);
            columns.Bound(c => c.FileName).Title("File Name").Sortable(true).Width(250);
        }
  
            )
            .Pageable()
            .Sortable(sort => sort.AllowUnsort(false))
            .Scrollable(scr => scr.Height(400))
            .Resizable(resizable => resizable.Columns(true))
            .DataSource(dataSource =>
            dataSource.Ajax()
                .PageSize(20)
                .Batch(true)
                .ServerOperation(true)
                .Read(read => read.Action("GetPendDetailRecord", "Inventory", new { stockCode = Model.StockCode, storeID = Model.StoreID, fromDate = Model.FromDate, toDate = Model.ToDate, status = (Model.Status == null) ? string.Empty : string.Join(",", Model.Status), error = Model.Error}))
        )
        .ClientDetailTemplateId("DetailSectionTemplate")
        )
 
The child grid template:
@(Html.Kendo().Grid<PendDetailSectionDTO>()
    .Name("pendDetailSectionGrid_\\#=DetailSection.ID\\#")
    .Columns(columns =>
    {
        columns.Bound(c => c.DetailSection.ID).HeaderTemplate(@<input type="checkbox" id="selectAllSection" />)
        .ClientTemplate("\\# if (StatusText=='Failed') { \\# <input type='checkbox' class='app_select_Section' data-refid='\\#: DetailSection.ID \\#'/> \\# } \\#")
        .Sortable(false).Width(20);
        columns.Bound(c => c.DetailSection.ID).Title("ID");
        columns.Bound(c => c.DetailSection.MaterialNo).Title("Stockcode").Width(90);
        columns.Bound(c => c.DetailSection.UID).Title("UID").Sortable(false).ClientTemplate("\\#if (DetailSection.UID!=null&&DetailSection.UID!='') {\\#<a href='" + @Url.Content("~/Inventory/InventoryDetail") + "?SerialNo=\\#=DetailSection.UID\\#'>\\#=DetailSection.UID\\#</a>\\#}\\#");
        columns.Bound(c => c.DetailSection.ManufacturePartNo).Title("Part No").Width(90);
        columns.Bound(c => c.StatusText).Title("Status").Width(55);
        columns.Bound(c => c.DetailSection.ErrMsg).Title("Error Message");
    }
    )
    .Pageable()
    .DataSource(source => source.Ajax()
        .PageSize(5)
        .ServerOperation(false)
        .Read(read => read.Action("GetPendDetailSection", "Inventory", new { detailRecordId = "#=DetailRecord.ID#" }))
    )
 
Both grid models:
public class PendDetailRecordDTO
{
    public string StatusText { get; set; }
    public string StorageLocationText { get; set; }
    public string DocNo { get; set; }
    public string FileName { get; set; }
    public SAP_DetailRecord_STG DetailRecord { get; set; }
    public PendDetailRecordDTO(SAP_DetailRecord_STG detailRecord)
    {
        DetailRecord = detailRecord;
    }
}
public class PendDetailSectionDTO
{
    public string StatusText { get; set; }
    public SAP_DetailSection_STG DetailSection { get; set; }
    public PendDetailSectionDTO(SAP_DetailSection_STG detailSection)
    {
        DetailSection = detailSection;
    }
}
 
Also I'm having troubles extracting the property using
.Name("pendDetailSectionGrid_\\#=DetailSection.ID\\#")
and
data-refid='\\#: DetailSection.ID \\#'

Which throws "Invalid Template" error. Is it because the property is not of the model but of the wrapped class? But then the following works just fine:
.ClientTemplate("\\#if (DetailSection.UID!=null&&DetailSection.UID!='') {\\#<a href='" + @Url.Content("~/Inventory/InventoryDetail") + "?SerialNo=\\#=DetailSection.UID\\#'>\\#=DetailSection.UID\\#</a>\\#}\\#")
 
Thank you and regards,
Michael Pham.
Eyup
Telerik team
 answered on 25 Jan 2017
1 answer
247 views
Hi, 

I have a Grid with a DropDownList column and another TextFields with ClientTemplate. The DropDownList shows a Spinner where I can select the ID of list, and when the field lost focus, shows a text with the text field of list.

I need that when I click on column, show me the DropDownList, not a Spinner.


@(Html.Kendo().Grid(Model.Contacts)
    .Name("Contacts")
    .ToolBar(tools => tools.Create().Text("Agregar nuevo contacto"))
    .Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom))
    .Columns(columns =>
    {
        columns.Bound(p => p.Name).ClientTemplate("#= Name #" +
            "<input type='hidden' name='Contacts[#= indexContactsBasic(data)#].Name' value='#= Name #' />"
        );
        columns.Bound(p => p.CellPhone).ClientTemplate("#= CellPhone #" +
            "<input type='hidden' name='Contacts[#= indexContactsBasic(data)#].CellPhone' value='#= CellPhone #' />"
        );
        columns.Bound(p => p.Email).ClientTemplate("#= Email #" +
            "<input type='hidden' name='Contacts[#= indexContactsBasic(data)#].Email' value='#= Email #' />"
        );
        columns.Bound(p => p.Occupation).ClientTemplate("#= Occupation #" +
            "<input type='hidden' name='Contacts[#= indexContactsBasic(data)#].Occupation' value='#= Occupation #' />"
        );
        columns.ForeignKey(p => p.ThirdPartyId, ViewBag.EmployeeInformationId as SelectList, "Value", "Text").Width(100);
        columns.Command(command => command.Destroy()).Width(100);
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model =>
        {
            model.Id(p => p.Id);
        })
        .ServerOperation(false)
    )
)


Regards,
Daniel
Konstantin Dikov
Telerik team
 answered on 25 Jan 2017
3 answers
361 views

Hi Team.

I'm using a onChange event to select the row in a grid. When I select a row, an event will be triggered. Also, the color of the row is changing automatically to let me know which row is selected. Now, I have a custom command column, which is a button linked with another js function. I want to achieve that when I click the button, the onChange() of this row is also triggered. Is that possible?

Konstantin Dikov
Telerik team
 answered on 24 Jan 2017
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
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?