Telerik Forums
UI for ASP.NET MVC Forum
2 answers
517 views

Hello,

in my ASP.NET MVC application I have a Kendo Button that is calling a controller action. While this action is working I'm showing a Kendo progress control. The controller action is a long running action that is updating several database items. In addition to my current solution I'm searching for a solution to show the progress of the long running action (e.g. display "Updated x of y items").

This is extract of my current solution:

View:

        @(Html.Kendo().Button()
              .Name("updateItems")
              .Content("Update items")
              .Events(events => events.Click("onClickUpdateItems")))
 
<script>
    function onClickUpdateItems() {
        kendo.ui.progress($("#content"), true);
        var items = getAllItems();
        $.ajax({
                type: "POST",
                url: "@Url.Action("UpdateItems", "Item")",
                data: JSON.stringify({
                    items: items
                }),
                contentType: "application/json"
            })
        kendo.ui.progress($("#content"), false);
</script>

 

In the corresponding controller action I iterate over all passed items. While the action is running I want to show the user how many items have been processed. Is there any possibility to realise this?

Regards

Raphael

Raphael
Top achievements
Rank 1
 answered on 07 Nov 2017
7 answers
4.4K+ views
I admit it, NuGet has spoiled me.

Will there be a NuGet package for KendoUI MVC? If so, is that only for Open Source projects, or can licensed users ship with the binary installed by NuGet?

Thanks,
BOb
Gordon
Top achievements
Rank 1
 answered on 06 Nov 2017
1 answer
289 views

Hello!

I would like to upload a file to the server and also write some data into SQL database after the user fills a form with those metadata. I used the widget this way:

 

@Html.Kendo().Upload().Name("docUpload").Async(a => a.Save("UploadFile", "Dokumentum", new { id = Model.Id }).AutoUpload(false)).Multiple(true).Events(ev => ev.Upload("onUpload").Error("onError").Success("onSuccess"))

 

The widget first calls onUpload javascript that calls the action that stores the metadata in SQL (input parameter is json). This action returns empty content if successful, or content with the error message if fails.

Either the first action was successful or failed, the widget calls the UploadFile action, that stores the file on the server (input parameter is HttpPostedFileBase). This action also returns with an empty content if it was successful.

This is works perfectly. My problem is, that what if the metadata writing fails (because of some validation or anything) and the file will be copied to the server. Or the metadata writing is successful but the file store fails. I would like the widget returns successful message only if both are successful or error message if one of them fails (of course the other action shouldn't be executed).

 

Here's the onUpload javascript:

function onUpload(e){
 
var json=new Object();
json["json"]=JSON.stringify({...blah-blah});
 
$.ajax({
url: '@Url.Action("Save,"Controller"),
async: false,
type:"POST",
data:json,
dataType:'json',
success:function(result){},
error:function(error){}
});
}

Thanks for your help

Neli
Telerik team
 answered on 06 Nov 2017
4 answers
718 views

Hello,

In my mobile application there is an Editor who value i want to submit on save button click. But when i post form serialize the Controller gets no value for Editor in formcollection

@(Html.Kendo().MobileView()
.Name("Notizen")
.Stretch(true)
.Layout("mobile-tabstrip")
.Title("Notizen")
.Content(@<text>
 
     <form class="frmAdressNotes" action="@Url.Action("SubmitMobileNotes", "AdressDetail")" id="frmAdressNotes" method="post">
@(Html.Kendo().Editor().Value(Model.Notes)
.HtmlAttributes(new { style = "width: 480px;height:350px"})
.Name("editor").Encode(true)
)
</form>

</text>)
)


@Html.Hidden("txtTheme1", Session["theme"].ToString())
@(Html.Kendo().MobileLayout()
.Name("mobile-tabstrip")
.Header(obj => NavBarTemplate(this))
)

@helper NavBarTemplate(WebViewPage page)
{
@(Html.Kendo().MobileNavBar()
.Content(navbar =>
@<text>
               
     @(Html.Kendo().MobileButton()
.Align(MobileButtonAlign.Right)
.HtmlAttributes(new { @class = "save"})
.Events(events => events.Click("onClick"))
.Text(""))
</text>)
)
}

 

function onClick(e) {

var $form = $("#frmAdressNotes");
$form.find("[data-role=editor]").each(function () {
var editor = $(this).data("kendoEditor");
// ... append a hidden input that holds the editor value
$("<input type='hidden' />")
.attr("name", editor.element.attr("id"))
.val(editor.value())
.appendTo(form);
});
      
        var dataPost = $form.serialize();

$.ajax({
url: "@Url.Action("SubmitMobileNotes", "AdressDetail")",
type: 'POST',
strNotes: dataPost,
cache: false,
aysnc:false,
success: function (data) {
if (data == "Error") {
alert(data);
} else {
                    
                    window.location.href = data;
}
}
});

}

 

if i write the code in form submit Event it Posts correctly. But i Need a Ajax call .Here is my Controller method

public void SubmitMobileNotes(ControlsContext notemodel, FormCollection formCollection)
{

string keyvalue = formCollection["editor"];

 

keyvalue is always null

 

Thanks

 

Anamika

Joana
Telerik team
 answered on 03 Nov 2017
1 answer
650 views

Hi,

Can you please a documen or sample code, How to hide a loading icon in Grid.

Regards
Suman G

Preslav
Telerik team
 answered on 03 Nov 2017
1 answer
4.6K+ views
Using 2013.1.514.340

When I get the value of a datepicker control in javascript it is return in the following format example: Thu Jul 4 00:00:00 CDT 2013. When I try to use DateTime.Parse to get the .Net Date it returns false. Is there a way to get a value from the DatePicker that is convertible to a .Net DateTime?

Thanks,

Billy Jacobs
Rob
Top achievements
Rank 1
 answered on 02 Nov 2017
1 answer
285 views

Hello ,

 

i have a mobile application which embeds a grid with scrollable Feature. Works fine in all android Browsers. But on iPhone the vertical scroll do not work. What could be causing this . I have set height as well.

@(Html.Kendo().MobileView()
.Name("Adressaktivitäten")
.Stretch(true)
.Layout("mobile-tabstrip")
.Title("Adressaktivitäten")
.Content(@<text>
<div >
<table style="width:100%;">
<tr><td>
@if (Model.AdressImgURL != "")
{
<img src="@Url.Action("GetAdressImage", "AdressDetail", new { strFilePath = Model.AdressImgURL })" alt="" style="height:100px;width:80px;" >
}
else
{
<img src="~/Images/vendor_big.png" alt="" style="height:80px;width:80px;" >
}
</td>
<td ><span style="white-space: pre-line;font-weight:bold;">
@Model.Title
</span>
</td>
<td class='alnright'> <a data-role="button" data-icon="search" style="font-size:16px;vertical-align:middle;border-radius: 0px;border:none;outline: 0;" href="@Url.Action("Index", "Adress")"></a>
</td>
</tr>
<tr></tr>
<tr></tr>
</table>
<div>
@(Html.Kendo().Grid(Model.AdrAktGrid)
.Name("Grid_Activity")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("ObjectActivity_Read", "AdressActivity"))
.ServerOperation(false)
)
.Columns(columns =>
{
if (ViewBag.ObjListHeader != null)
{
for (int j = 0; j < ViewBag.ObjListHeader.GetLength(0); j++)
{
if (ViewBag.ObjListHeader[j, 0] == "ID")
{
columns.Bound(ViewBag.ObjListHeader[j, 0]).Title(ViewBag.ObjListHeader[j, 0]).Visible(false);
}       
                else
{
if (ViewBag.ObjListHeader[j, 0] != null)
{
if (ViewBag.ObjListHeader[j, 1] == "False")
{
columns.Bound(ViewBag.ObjListHeader[j, 0]).Title(ViewBag.ObjListHeader[j, 0]).Visible(false);
}
else
{
columns.Bound(ViewBag.ObjListHeader[j, 0]).Title(ViewBag.ObjListHeader[j, 0]).Width(120);
}
}
}
}
}
})
.HtmlAttributes(new { style = "height: 300px;" })
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single))
.Scrollable()
.Resizable(r => r.Columns(true))
)
</div>
</div>
</text>)
)

 

In older iphone browser it works fine though.

 

Thanks

 

Anamika

Konstantin Dikov
Telerik team
 answered on 02 Nov 2017
5 answers
898 views

Hi
May last question of the year.  I promise!  I really don't ask for help much for a long time user.

For my MVC scheduler edit popup I use a CustomEditorTemplate.cshtml because I added 2 extra fields.  Nice!

In that file I use the code below for my OwnerID dropdownlist which usually has 8 items. 
However,  I oftem limit the dropdownlist to only one item when I know the user is filtered to one OwnerID.
So I want the dropdown list to only have that one OwnerID in it automatically selected.  But... for some reason a blank row is at the top of the DDL so the user has to manually select the only one item.  I don't use .OptionLabel("xxx").  How can I get rid of the empty row at the top and make this work?

I can't switch to another ddl control because I need .Data("filterdata")  to pass parameters to.

Thanks

 

 

<div data-container-for="OwnerID" class="k-edit-field">
       @(Html.Kendo().DropDownListFor(model => model.OwnerID)
       .HtmlAttributes(new { data_bind = "value:OwnerID", style = "width: 300px" })
       .DataTextField("Text")
       .DataValueField("Value")
       .ValuePrimitive(true)
       .Template("<span class='k-scheduler-mark' style='background-color:\\#= data.Color?Color:'' \\#'></span>\\#=Text\\#")
       .DataSource(ds => ds
                .Read(read => read
                      .Action("GetDepartmentListx", "Scheduler")
                      .Data("filterdata")  // in index page this function passes checkbox data parameters
                      ))
       )
   </div>
Dimitar
Telerik team
 answered on 02 Nov 2017
2 answers
364 views

Hi,

In kendo grid view, on databound locked and lockable is not looking good and layout problem. Here sample code

http://dojo.telerik.com/@Suman%20G/OdUCiP

Is there any alternative events available?.

Regards
Suman G

Suman
Top achievements
Rank 1
 answered on 02 Nov 2017
3 answers
638 views
Using the Kendo Autocomplete to search in a collection of 5000+ items stored in a database. Due to that is chosen to perform the filtering on the server. The problem is that the search value (parameter filter) received by the function is always NULL.

The project is MVC4/razor based, on the page the autocomplete is defined like this:

@(Html.Kendo().AutoComplete()
                  .Name(
"ExternalId")
                  .Placeholder(
"Search...")
                  .MinLength(3)
                  .DataSource(source => source.Read(read => read.Action(
"SourcesForAutoComplete", "Source")
    .Data(
"onAdditionalData"))
                  .ServerFiltering(
true))
                  .HtmlAttributes(
new { style = "width:468px" }))
The javascript handling the additional data events is placed at the end of the cshtml of the page:
<script>
    function onAdditionalData() {
        return { filter: $("#ExternalId").val() };
    }
</script>

The MVC Source controller has the following function to provide the data and search functionality:
public JsonResult SourcesForAutoComplete(string filter)
{
    using (var db = new EasyTaskIntegrationEntities())
    {
        ...
        return Json(result, JsonRequestBehavior.AllowGet);
    }
}
Can anyone explain why the filter value received is NULL instead of the value typed in the Autocomplete?
kamlesh
Top achievements
Rank 1
 answered on 02 Nov 2017
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
Wizard
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
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?