Telerik Forums
UI for ASP.NET MVC Forum
3 answers
144 views
This feels like it should be a simple question, but I can't find the answer anywhere.

If a user clicks the remove button (x) on the only file in an upload list, the file is removed from the list and the 'upload' button is hidden. How can I simulate this?

I'm overriding the 'onselect' event and checking for existing files in a directory. If the user selects 'no, I don't want to replace the existing file', I'm removing the item from the upload list successfully, but if it's the only file in the list, I'm left with the button and a border around the empty list.

Thanks in advance.
Dimiter Madjarov
Telerik team
 answered on 01 Apr 2014
3 answers
293 views
I tried this solution (http://www.telerik.com/support/code-library/submit-form-containing-grid-along-with-other-input-elements), for posting a grid inside an html forum and work correctly.
But if I have a grid with checkboxes I don't understend how I can the true or false value.

I've tried this solution, but doesn't work.

columns.Bound(p => p.Inside).ClientTemplate(
"<input type='checkbox' #= (Inside=== true) ? checked : '' # />" +
"<input type='hidden' name='CAB[#= indexCAB(data)#].Inside' value='#= Inside#' />");

Someone can help me.

Thanks
Daniel
Telerik team
 answered on 01 Apr 2014
1 answer
283 views
Hi,

I have the following kendo grid in my page:

@(Html.Kendo().Grid<Di.Service.Tracking.Models.DomainObjects.DTrackingFileEvent>()
 .Name("fileAuditing")
 .Columns(columns =>
{
columns.Bound(c => c.IsError);
columns.Bound(c => c.EventDateTime).Title(@Di.Nls.Label.Event_Date_Time);
columns.Bound(c => c.Details).Title(@Di.Nls.Label.Details);
columns.Bound(c => c.Description).Title(@Di.Nls.Label.Description);
columns.Bound(c => c.Result).Title(@Di.Nls.Label.Result);
})
.ClientRowTemplate(
"<tr bgcolor=#:IsError ? 'Pink' : 'White'# data-uid='#: uid #'>" +
  "<td>" +
  "# if(IsError == true) {# " +
"<img src='/Images/FileState/Error.gif' />" +
"#} else {# " +
"<img src='/Images/FileState/Ok.gif' />" +
"#}#" +
  "</td>" +
  "<td>#: EventDateTime #</td>" +
  "<td>#: Details #</td>" +
  "<td>#: Description #</td>" +
  "<td>#: Result #</td>" +
"</tr>"
)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.ID))
.Read(read => read.Action("FileAuditingDetails", "FileDetails", new { iFileID = iFileID }))
.Events(e=>e.RequestEnd("onRequestEnd"))
)
)

<script>
function onRequestEnd(e) {
  //do something with event date time
}
</script>

My goal is to format the "Event date time" column so it provides a value based on the user time zone info. In order to do that I wanted to handle the "requestEnd" event, but when I do that I cannot see any data on the grid.

Removing the following line .Events(e=>e.RequestEnd("onRequestEnd")) load all the data correctly.

Any ideas how to achieve my goal?
Alexander Popov
Telerik team
 answered on 01 Apr 2014
1 answer
181 views
Hi there,

I am just getting to grips with WebApi and how to use them with the MVC wrappers. But I am at a loss on how to ensure that the authentication is working correctly as part of the project.

My scenario is I have front end website (www.myfrontendwebsite.com) which is running on one server and then I have the service website with all my Business logic running on a webapi back end website (www.mywebapiwebsite.com) this may/ may not be running on a separate website.

I am forcing my users to log in to ensure that they can access only the parts of the sites they should have.

Obviously with the web api project this needs to be protected as well so I need the user to be authenticated.

Now I am  trying to do something like this with a combobox:


Html.Kendo().ComboBox()
.Name("DateSetup")
.Suggest(true)
.Filter(FilterType.Contains)
.DataSource(data =>
{
data.Read(read => read.Url("http://localhost:59236/api/GenericReport/GetDateFilterTypes"));
})
.Placeholder("Select date setup")


so I know I need to add some additional information to the header that is being provided but how can I do that from the read.Url method? Do I do this via adding .Data afterwards or is there another way of do it.

I have already enabled CORS to work as this works when I an using allow annoynomous.

Thanks in advance.


                      .HtmlAttributes(new { style = "min-width:100%;" })

Daniel
Telerik team
 answered on 01 Apr 2014
5 answers
378 views
I have a kendo grid which uses server binding. I need to implement batch update in the same. How can i proceed for this.
Below is the example of grid I am using.

@(Html.Kendo().Grid(Model) // Bind the grid to the Model property of the view
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p=> p.addressId).Hidden(true);
columns.Bound(p=> p.Name).Title("Name");
columns.Bound(p=> p.Phone);
)
.Pageable() //Enable paging
.ToolBar(commands => commands.Create())
//Editable(editable => editable.Mode(GridEditMode.Inline))
.DataSource(dataSource => dataSource
.Server()
//.Batch(true)
// Configure CRUD -->
.Model(model => model.Id(p => p.ContactId))
.Create(create => create.Action("Create", "Home"))
.Read(read => read.Action("Index", "Home"))
.Update(update => update.Action("Update", "Home"))
.Destroy(destroy => destroy.Action("Destroy", "Home"))
// <-- Configure CRUD
)
.DetailTemplate(...)
)

Now i want to have a button, on click of which the data in the grid could be updated. What is the best way to proceed with this.
Batch(true) is not working with Server()?
Petur Subev
Telerik team
 answered on 31 Mar 2014
1 answer
642 views
Hi guys,

I have a menu exposed as a column in a grid. In the old system I'm changing over to the grid I iterate over each item, inspect some value, and determine if the menu item should be included. I'm not sure how I would do this with the MVC helper because it's based on values from each row. Here's my grid/menu:

01.@(Html.Kendo().Grid<ListingViewModel>()
02.      .Name("grid")
03.      .DataSource(dataSource => dataSource
04.          .Ajax()
05.          .Read(read => read.Action("RefreshTable", "Authorizations"))
06.      )
07.      .Columns(columns =>
08.      {
09.          columns.Bound(x => x.Number)
10.              .Template(@<text></text>).HtmlAttributes(new { @class = "templateCell" })
11.              .ClientTemplate(
12.                Html.Kendo().Menu()
13.                    .Name("menu_#=Number#")
14.                    .OpenOnClick(true)
15.                    .Events(e => e.Select("selectMenu"))
16.                    .Items(its => its.Add().Text("#=Number#").Items(nested =>
17.                    {
18.                        nested.Add().Text("Edit").HtmlAttributes(new { data_number = "#=Number#" });
19.                        nested.Add().Text("Add Comment").HtmlAttributes(new { data_number = "#=Number#" });
20.                        nested.Add().Text("Cancel").HtmlAttributes(new { data_number = "#=Number#" });
21.                        nested.Add().Text("Transfer").HtmlAttributes(new { data_number = "#=Number#" });
22.                        nested.Add().Text("View Comments").HtmlAttributes(new { data_number = "#=Number#" });
23.                    }))
24.                    .ToClientTemplate().ToHtmlString());
25.          columns.Bound(x => x.Status);
26.          columns.Bound(x => x.Started);
27.          columns.Bound(x => x.Description);
28.      })
29.      .Pageable()
30.      .Sortable()
31.      .Events(events => events.DataBound("initMenus"))
32.    )

So lines 18-22 are where I build the menu. In my situation I want to include 18 and 19 if the status is a certain value and include line 20 if the description contains anything (as an example).

Even if I did this after the fact going through the entire grid using some event I really need access to the view model, or else I'll have to expose (or maybe hide) some additional fields that are used as part of the determination. For example there might be a .UserCount field that's not exposed but is needed to determine if the menu item in line 22 is added or not.

I'm looking to hide or show menu items based on the row data but could also just grey out/disable some items. In any case I'm not sure how to do this with my model and it seems like the only way to do something like this is to interrogate the HTML after the grid is built.

Hopefully that explains what I'm looking to do and what I'm working with.

Thanks.
Daniel
Telerik team
 answered on 31 Mar 2014
1 answer
279 views
Hello,

I have an XML file with variable number of Tabs and controls(TextBox,combobox,grid etc) to be displayed whne each tab is selected. My Controller parses the XML and creates a model of type
Dictionary<string, DefaultControlsViewModel>
where string part is the tabitem.text and DefaultControlsViewModel is a list of different controls to be displayed in that tab.
I Need to create all the Tabs and ist Contents dynamically on load. Is there a way to bind this Kind of model to view having a tabstripe and create all Tabs and ist controls dynamically?Attached a small sample Project, i have controls.xml and model with tab Name and Array of controls in that tab. Need the code for binding the model to tabstripe in index.cshtml

Thanks

Anamika
Dimo
Telerik team
 answered on 31 Mar 2014
2 answers
192 views
Hi Telerik Team.

I copy paste the Telerik code of "ScheldulerCustomEditor".

I have the following error : "The field Start must be a date/ The field End must be a date".

I search in the forum but I don't thing it's a trouble of culture.
In FireBug, the right "cultures/kendo.culture.fr-FR.min.js" is loaded.
And
     var culture = Thread.CurrentThread.CurrentUICulture.ToString();
     var cultureServer = Thread.CurrentThread.CurrentCulture.ToString();
give both "fr-FR" as a result.

And i followed the Kendo Globalization tutorial
var culture = System.Globalization.CultureInfo.CurrentCulture.ToString();
<script src="@Url.Content("~/Scripts/kendo/2014.1.321/cultures/kendo.culture." + culture + ".min.js")"></script>

I solved this trouble with Data annotation

[DataType(DataType.Time)]
[UIHint("End")]
[Required(ErrorMessage = "Please select a End time")]
[DateGreaterThan(OtherField = "Start")]
public DateTime End
{
    get
    {
        return end;
    }
    set
    {
        end = value.ToUniversalTime();
    }
}

But i have another error. It's display that "The isAllDay field is required".
Alexander Popov
Telerik team
 answered on 31 Mar 2014
1 answer
132 views
Hi,

I am getting Drag and Drop issue of the Kendo UI Treeview control in IE 10 and 11.

Help is required on this. It's very urgent.

Regards,
Satish.N 
Petur Subev
Telerik team
 answered on 31 Mar 2014
1 answer
137 views
As of time of this post, the ForeignKey demo at

http://demos.telerik.com/kendo-ui/web/grid/foreignkeycolumn.html

does work on Chrome and Internet Explorer but does not work on FireFox.  The category dropdown list does not display properly so that values can be selected.

This test was done on current FireFox 28.0.

Also it would be nice if there was a simpler more elegant way to create a ForeignKey dropdown list other than what's shown in the demo.
Kamen Bundev
Telerik team
 answered on 31 Mar 2014
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
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
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
DateInput
MediaPlayer
TileLayout
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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?