Telerik Forums
UI for ASP.NET MVC Forum
1 answer
492 views
I'm using the editor and its in a jquery ui dialog, and I can't type text into the editor.

I call this function to open the jquery ui dialog:
function openSendEmailWindow(checkedArray) {
debugger;
$.ajax({
cache: false,
url: '/SendEmail/Email',
data: { checkedRecords: checkedArray.toString() },
type: "GET",
success: function (response, status, jqXHR) {
//debugger;
if (jqXHR.responseText) {
//debugger;
$("<div id='sendEmailWindow' style='display:none' title='Send Email'></div>").appendTo(".body-content");
$("#sendEmailWindow").html(response);
$("#sendEmailWindow").dialog({
position: ['top', 60],
width: 1300,
height: 625,
modal: true,

 close: function (event, ui) {
$(this).dialog('destroy').remove();
}
});
}
},
error: function (jqXHR) {
//debugger;
alert(jqXHR.statusText);
}
});
}

This is my partial view:
<div id="windowWrapper">
@using (Ajax.BeginForm("Email", "SendEmail", new AjaxOptions() { HttpMethod = "Post" }, new { id = "sendEmailForm", role = "form" }))
{
<div id="commandBar">
<span style="line-height:2em; margin-left:0.125em">
<button type="submit" class="k-button k-button-icon"><span class="k-icon k-update"></span></button>
<button type="button" onclick="closeSendEmailWindow(event);" class="k-button k-button-icon"><span class="k-icon k-cancel"></span></button>
</span>
</div>
<div id="windowContent">
<br />
@*@Html.AntiForgeryToken()*@
@Html.ValidationSummary(false, "Please correct the errors and try again:")
<div class="container-fluid">
<div class="row">
<div class='col-md-12'>
<div class="form-group">
@Html.LabelFor(m => m.Subject)<br />
@Html.TextBoxFor(m => m.Subject, new { @class = "form-control" })
@Html.ValidationMessage("Subject", "*")
</div>
</div>
</div>
<div class="row">
<div class='col-md-12'>
<div class="form-group">
@Html.LabelFor(m => m.Message)
@(Html.Kendo().EditorFor(m => m.Message)
.HtmlAttributes(new { @class = "form-control", style = "height:400px" })
)
@Html.ValidationMessage("Message", "*")
</div>
</div>
</div>
<div class="row">
<div class='col-md-12'>
<div class="form-group">
@Html.LabelFor(m => m.Attachment)<br />
@(Html.Kendo().Upload()
.Name("Files")
.HtmlAttributes(new { @class = "form-control" })
)
@Html.ValidationMessage("Attachment", "*")
</div>
</div>
</div>
</div>
@Html.HiddenFor(m => m.CheckedRecords)
@Html.HiddenFor(m => m.Attachment)
</div>
}
</div>

<script type="text/javascript">

function closeSendEmailWindow(e) {
this.parent.$("#sendEmailWindow").dialog('close');
}

$(document).ready(function () {

//for kendo numeric textbox to enable validation
$.validator.setDefaults({
ignore: ""
});

$.validator.unobtrusive.parse("#sendEmailForm");

$('#sendEmailForm').submit(function (e) {
debugger;
e.preventDefault();
$.ajax({
cache: false,
url: '@Url.Action("Email", "SendEmail")',
type: 'POST',
data: $(this).serialize(),
success: function (response, status, jqXHR) {
debugger;
if (jqXHR.responseText == '') {
$('input:checkbox').each(function () {
this.checked = false;
});
checked = {};
checkedArray = null;
 $("#sendEmailWindow").dialog('close');
}
},
error: function (jqXHR) {
debugger;
alert(jqXHR.statusText);
}
});
return false;
});

});

</script>


Daniel
Telerik team
 answered on 21 Mar 2014
2 answers
162 views
I have Telerik MVC grid in my view.

I'm binding the column "Debit Balance" value with calculation in my client side and data binding properly ,here is how i bind data

01.//my grid
02.    @( Html.Telerik().Grid<Orpac.Models.E_GetCarHar_Result>()
03.                     .Name("grdAccTransactions").NoRecordsTemplate("No record to display")
04.                     .Localizable("")
05. 
06.                     .HtmlAttributes("width: 100%;cellpadding:0;")
07.                     .Columns(columns =>
08.                     {
09.                         columns.Bound(e => e.CrhIdent).Hidden().IncludeInContextMenu(false);
10.                         columns.Bound(e => e.CrhTip).Hidden().IncludeInContextMenu(false);
11.                         columns.Bound(e => e.CrhTarih).Title((string)ViewData["Date"]);
12.                         columns.Bound(e => e.CrhTipNam).Title((string)ViewData["Description"]);
13.                         columns.Bound(e => e.CrhRef).Title((string)ViewData["Ref"]);
14.                         columns.Bound(e => e.CrhIslem).Hidden().IncludeInContextMenu(false);
15.                         columns.Bound(e => e.CrhDvzTut).Title((string)ViewData["Amount"]);
16.                         columns.Bound(e => e.CrhYrlTut).Title((string)ViewData["DebitBalance"]);
17.                         columns.Bound(e => e.CrhVade).Title((string)ViewData["DueDate"]);
18.                     })                
19.                     .DataBinding(d => d.Ajax().Select("GridAccountTransactionBinding", "Transaction"))
20.                     .ClientEvents(events => events.OnRowDataBound("onRowDataBoundAccTrans").OnLoad("onloadaccountTR").OnRowSelect("onRowSelectaccountTR"))
21.                     .Selectable()
22.                     .Sortable()
23.                     .Pageable(paging => paging.Enabled((bool)ViewData["paging"]).PageSize(10))
24.                     .Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
25.                     .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
26.                     .Footer(((bool)ViewData["showFooter"]))
27.                     .Scrollable(scrolling => scrolling.Height(330))
28.                     .Resizable(config =>
29.                     {
30.                         config.Columns(true);
31.                     })
32.                     .Reorderable(config =>
33.                     {
34.                         config.Columns(true);
35.                     })
36.                    .ColumnContextMenu()
37.                   )
38.//this is how to bind grid
39. 
40.                    E_Get_Result p = new E_Get_Result();
41.                    p.CrhIdent = item.CrhIdent;
42.                    p.CrhTarih = item.CrhTarih;
43.                    p.CrhVade = item.CrhVade;
44.                    p.CrhRef = item.CrhRef;
45.                    p.CrhIslem = item.CrhIslem;
46.                    if (p.CrhIslem == "-")
47.                    {
48.                        p.CrhDvzTut = item.CrhDvzTut;
49.                        p.DebitBalance = Dbalance - item.CrhDvzTut;
50.                    }
51.                    else
52.                    {
53.                        p.CrhDvzTut = (-1)*item.CrhDvzTut;
54.                        p.DebitBalance  = Dbalance  + item.CrhDvzTut;
55.                    }

but when i group by with any dataMy row values binding without calculation? I can trace it with debugger values fetching true but grid doesn't show the same valueAfter Group by "Debit Balance" value shows uncalculating

Do you know this reason?Please help meThnx All
Haluk
Top achievements
Rank 1
 answered on 21 Mar 2014
4 answers
556 views
My application uses several Kendo UI controls.  Any one that I have tried in Chrome or Safari the verticle scroll bar is not visible. 
You are able to use the mouse scroll wheel and it will scroll up and down, but it should display the scroll bar. 

I saw a similar issue on another thread, but was no able to find it again.  And some one from Telerik responded claiming they could not reproduce this.  I was able to reproduce this on the http://demos.telerik.com/kendo-ui/web/grid/index.html site as the other thread described in both Chrome and Safari.  And no Chrome version was mentioned.  I have attached a working Firefox with scroll bar and a Chrome same page with out the scroll bar.

If there is a way to override this and resolve that would be most helpful.

Please see attached.


Pete
Pete
Top achievements
Rank 1
 answered on 20 Mar 2014
4 answers
299 views
Hi

I have a issue while trying save the grid state and loading it back if grouping is there "Uncaught TypeError: Cannot read property 'length' of undefined "

Steps to reproduce
1. Go to Products link in home page.
2. Group with any column in the grid (which will save the state to local storage).
3. refresh the page (this gives the error mentioned above in developer options console).

Please provide a suitable resolution for the same.

Note: I have attached the sample project (aspnetmvc-episode3.zip)

Regards
Anas
Daniel
Telerik team
 answered on 20 Mar 2014
1 answer
79 views
When hovering over a menu item in IE8, the styles to highlight that menu item don't seem to working.  I was able to reproduce this behavior here:

http://demos.telerik.com/kendo-ui/web/menu/index.html 

Any suggestions?

Dimo
Telerik team
 answered on 20 Mar 2014
1 answer
292 views
Hi,

I have used kendo mvc grid with ajax binding. One of the column of grid has small size thumbnails. when I hover on those thumbnails they should get expanded(zoom in zoom out) outside the cell so it does not affect row height.

i have used below javascript function and i am calling it  on onmouseover event of img tag inside clienttemplate, but it expands images inside cell. I want it outside the cell. Can you please let me know how i can achieve it without using lightbox or jquery hoverintent plugins
<script>
    function MyFunction()
    {
        $(document).ready()
        {
         $("#GridTable tbody tr td #wrap #Grid .k-grid-content table tbody tr td text img").hover(function() {
             kendo.fx(this).zoom("in").startValue(1).endValue(2).play();
         }, function() {
            kendo.fx(this).zoom("out").endValue(1).startValue(2).play();
        });
        }
    }
</script>



Vladimir Iliev
Telerik team
 answered on 20 Mar 2014
1 answer
551 views
Hello,

Here is my scenario. I have a grid populated by an ajax call.
The grid may or may not be paginated.
The user can apply filters, sorts, whatever.
I need to be able to get a list of all the rows in the grid ( not just on the visible page ).
Basically an export of the state of the grid taking into consideration all the user actions.

What's the best way to do this ?
Nikolay Rusev
Telerik team
 answered on 20 Mar 2014
2 answers
549 views

I need to restrict the size of the image file in Kendo Editor ImageBrowser. The project is similar to the demo http://www.telerik.com/clientsfiles/e3e38f54-7bb7-4bec-b637-7c30c7841dd1_KendoEditorImageBrowser.zip?sfvrsn=0 .

Image browser has a possibility to use filtering by file extension http://docs.telerik.com/kendo-ui/api/web/editor#configuration-imageBrowser.fileTypes, but there is no similar way to set the maximum image file size.

I tried to set change and select events for ImageBrowser as here Kendo UI Editor - open event , but they were never invoked.

The difficult things are:
1) is created on fly, it is hard to set “change” event
2) even if that event is set, on e.preventDefault() kendo image browser still sure it was uploaded and tries to get the preview image from controller.

The thing I did was: trying to find that input control when each element is inserted to document. Once I found it, I marked it as hooked, to avoid hook it twice:

function restrictUpload(e) {
    try {
        var files = e.target.files;
        var len = files.length;
 
        var totalSize = 0;
        for (var i = 0; i < len; ++i) {
            totalSize += files[i].size;
        }
 
        if (totalSize > 1024 * 1024) {
            alert("You can add images less than 1MB size only");
            e.preventDefault();
        }
    }
    catch (err) {
        console.log("err.message " + err.message);
    }
}
 
function initUploadRestrict() {
    try{
        var inputControl = $('input[name=file][type=file][data-role=upload]');
        console.log("inputControl.length= " + inputControl.length);
 
        if (0 !== inputControl.length &&
            inputControl.data("HookedRestrictUpload") !== true)
        {
            inputControl.change(restrictUpload);
            inputControl.data("HookedRestrictUpload", true);
        }
    } catch (err) {
        console.log(err.message);
    }
}
 
$(document).bind('DOMSubtreeModified', function () {
    console.log("DOMSubtreeModified call");
    initUploadRestrict();
})

I know this is wrong solution, because ImageBrowserController.Thumbnail is still invoked and the image still tries to appear in preview. Another con: DOMSubtreeModified is executed for hundreds times.

How to make Kendo ImageBrowser to restrict upload of images by file size in correct way?

Thanks
Ben Puzzuoli
Top achievements
Rank 1
 answered on 19 Mar 2014
5 answers
238 views
I found problem with focus in kendo Editor that is opened in Kendo window in IE8-10.
I have Grid with Popup editor that contains text input (name) and kendo editor (text).

If i close the windows and focus is inside Kendoui editor and open the window again i can't click on any input(both text and name) at all. It just doesnt get focus (same as this http://www.kendoui.com/forums/mvc/editor/editor-issues-with-firefox-17.aspx, but was not resolved same way).
Odd thing is that if I press Tab key several times and than click on any input or editor - it works.

I'm using build from yeasterday, but it was present in last builds as well.
Ariel
Top achievements
Rank 1
 answered on 19 Mar 2014
1 answer
154 views
Hello,

When i bind the Multiselect list to ViewBag the list renders fine. However the "Values" property never gets set. I have tried with IEnumerable object as well as list<string> or string[] of ids. I cannot find any help online. When i post the viewmodel does post selected values. 
I have also played with Autobind true and false

Here is the code

@{
                       Html.Kendo().MultiSelectFor(model => model.ActivityIds)
                           .BindTo(new SelectList(ViewBag.Activity, "ActivityId", "ActivityName"))
                           .Value(new SelectList(ViewBag.SelectedActivites, "ActivityId", "ActivityName"))
                           
                           .Placeholder("Select Activity ..")                         
                           .HtmlAttributes(new { style = "width: 800px;" })
                           .Render();
                   }

ViewBag.Activity = db.GetActivityList(Constants.APP_SC).ToList();
            if(smallCellViewModel.HasValue() && smallCellViewModel.ActivityIds.HasValue())
            {
                ViewBag.SelectedActivites = db.GetActivityList(Constants.APP_SC).Where(c=>smallCellViewModel.ActivityIds.
                    Contains(c.ActivityId)).ToList();
            }
Alexander Popov
Telerik team
 answered on 19 Mar 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?