Telerik Forums
UI for ASP.NET MVC Forum
2 answers
127 views
I'm attempting to use a foreign key column and I sometimes get an unterminated string error while loading the page.  I determined that this is due to having a single quote in the data (not uncommon for users to do that).

This is easy to duplicate using the MVC Example project by simply changing an Employee name in the Northwind database to contain a single quote.  The Grid Foreign Key demo will show the error.  (BTW, Firefox doesn't really indicate the error, it just stops.  IE blows up.)

Encoding the string doesn't help.  The resulting data simply shows the ' value in the output.

Anyone else have a similar problem?
Mathieu
Top achievements
Rank 1
 answered on 15 Oct 2012
1 answer
138 views
I have a pretty basic grid that is not populated on load.  It requires users to enter search criteria first, which then searches the database and populates the grid.  Below is the grid code

Html.Kendo().Grid<ArrayOfSearchResultObjectSearchResultObject>(Model.Results)
.Name("srchGrd")
.Columns(columns =>
{
    columns.Bound(o => o.Chemical).ClientTemplate("<a title='#=Chemical#' href='" + Url.Action("", "ChemBioSearch", new { area = "Tools" }, Request.Url.Scheme) + "/GetDetail?ChemName=#=Chemical#&DetailID=#=ID#&DetailSource=#=SearchSource#&id=" + Model.ProjectGUID.ToString() + "' >" +
    "#=Chemical# </a>"
    ).Title("Chemical");
    columns.Bound(o => o.CasNumber).Title("CAS #");
    columns.Bound(o => o.UnNumber).Title("UN ID #");
    columns.Bound(o => o.FriendlySourceName).Title("Data Source");
})
        .DataSource(ds =>
        {
            ds.Ajax().ServerOperation(false).Read(read => read.Action("_GetSearchResults", "ChemBioSearch", new { area = "Tools" }));
        }
                    )
.Scrollable(scrolling => scrolling.Enabled(false))
.Sortable(sorting => sorting.Enabled(true))
.Pageable(paging => paging.Enabled(true))
.Filterable(filtering => filtering.Enabled(true))
.Groupable(grouping => grouping.Enabled(false))
.Render();
which used to work great but broke ever since i upgraded to the Kendo 924 version (and same problem since the 1002 as well) it doesn't work like it used to. 

Basically i have 2 controller methods.  The first (SearchChemBio) gets called when the user enters the search data and hits enter.  data gets sent no problem and send a partialresult (which contains the grid).  I have the ajax call in there in order to handle sorting/filtering/paging. 

[AcceptVerbs(HttpVerbs.Post | HttpVerbs.Get)]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public ActionResult _GetSearchResults([DataSourceRequest] DataSourceRequest request,ChemBioSearchModel mdl)
{
    if ((mdl != null) && (mdl.IsValid))
    {
        ArrayOfSearchResultObject rslt = SearchGlobal(mdl);
        if ((rslt != null) && (rslt.Items.Length > 0))
        {
            foreach (ArrayOfSearchResultObjectSearchResultObject arr in rslt.Items)
            {
                mdl.Results.Add(arr);
            }
        }
        return Json(mdl.Results.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
    }
    return Json(new List<ArrayOfSearchResultObjectSearchResultObject>().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
 
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult SearchChemBio(ChemBioSearchModel mdl)
{
    if (mdl != null)
    {
        if (ModelState.IsValid)
        {
            ArrayOfSearchResultObject rslt = SearchGlobal(mdl);
            if ((rslt != null) && (rslt.Items !=null) && (rslt.Items.Length > 0))
            {
                foreach (ArrayOfSearchResultObjectSearchResultObject arr in rslt.Items)
                {
                    mdl.Results.Add(arr);
                }
            }
            return PartialView("SearchResults", mdl);
        }
        else
        {
            return View(mdl);
        }
    }
    throw new ArgumentException("No Model found for Chem Bio Search");
}
unfortunately now, the model in the Ajax call (_GetSearchResults) is always blank now (it didn't used to be before the update).  Is there something i'm missing?  I feel like i'm doing double work here, but can't figure out how to marry both calls.
Phil
Top achievements
Rank 1
 answered on 15 Oct 2012
5 answers
446 views
Hi Guys!  I am new Asp.net MVC and KendoUI.... can you help me on how populate the grid dynamically? or for example if have to pick in a combobox, it will display the data according to the selected item???

Thank you very much! God bless
Gopi
Top achievements
Rank 1
 answered on 15 Oct 2012
0 answers
77 views
TreeView is not expanding on mobile devices (well, at least on iOS and Android):
ver 2012.2.913
styles and scripts in order:
kendo.common.min.css
kendo.default.min.css"
kendo.mobile.all.min.css

jquery-1.7.1.min.js
kendo.all.min.js
kendo.aspnetmvc.min.js

not expanding example:
         @(Html.Kendo().TreeView()
                .Name("sometree")
                .Items(treeview =>
                {
                    treeview.Add()
                        .Expanded(false)
                        .Selected(true)
                        .Items(items =>
                        {
                            items.Add().Text("S");
                            items.Add().Text("S");
                            items.Add().Text("S");
                        });
                })
                )
Simon
Top achievements
Rank 1
 asked on 15 Oct 2012
1 answer
795 views
Hi

Is there any way I can loop through the rows for a particular page or at least the page visible to the user.
What am I doing right now is iterating through all the rows in the datasource as below

var grid = $("#MyKendoGrid").data("kendoGrid");
var data = grid.dataSource.data();
$.each(data, function (i, row) {
        //do something
 });

But what if I want to iterate on the rows of a particular page.
I can get the current page by grid.dataSource.page(); Then what's next?

Please advise.
Nikolay Rusev
Telerik team
 answered on 15 Oct 2012
0 answers
114 views
Hi,

I have a "Create" form in my MVC application that has some fields like firstName, lastName...  and a Kendo grid.  The grid has two columns (namve/value pairs).

I can't create the values in the grid until I create the rest of the form.  I need to post all of the data on the form back at the same time.

Is there a way to post the grid data along with the rest of the form data?


Dave
Top achievements
Rank 1
 asked on 14 Oct 2012
0 answers
156 views
Hello,
I'm uploading a CSV file and try to parse it.
I want to return to the client a responsive message what is the issue (as I found it).

I've tried this:
Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
Response.ContentEncoding = Encoding.UTF8;
            Response.ContentType = "application/json; charset=utf-8";
            

return Json(myResponse, Response.ContentType, Response.ContentEncoding);

Where myResponse is of a specific type containing my status code. I'm checking the value of my Status Code (called Rc) and act accordingly. 

I'm changing the StatusCode, because the retry button appears and the user can try uploading again easily).
It work fine in Chrome and FF, but not in IE (all in my dev server)
I've change the behavior to be like this:

// for IE responseText
if (Request.Browser.IsBrowser("IE"))
{
     Response.StatusCode = (int)System.Net.HttpStatusCode.OK;
     Response.ContentType = "text/html; charset=utf-8";
}
// End of

and that solve the issue for IE.

BUT:
When moved to testing environment, the myResponse is holding the 'BadRequest' string and not my Json response, and then I don't have any info to display to the client.

So - I've removed the line 
Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;

and my js handler look like that
function onUploadSuccess(e) {
            //alert("Success (" + e.operation + ") :: " + getFileInfo(e));
 
            if (e.response.Rc != 'OK')
                addFileRow(e.files[0].name, e.response.ErrorMessages, e.response.CurrentTime, "uploadRowError""");
            else {
                var runCmd = "<div .... />";
                addFileRow(e.files[0].name, e.response.ErrorMessages, e.response.CurrentTime, "uploadRowSuccess", runCmd);
            }
        }
And the question: Can I mark the operation as failed in the onSuccess handler ? Thanks Shimshon
Shimshon
Top achievements
Rank 1
 asked on 14 Oct 2012
0 answers
105 views
Hi,
I am using KendoUI Grid in ASP.NET MVC3 Application and using MvcContrib.Mvc3-ci.3.0.73.0 for portable view. Everything in the grid working perfect. But having problem when I add "Batch Editing" feature. My error screen showing message like this:

The best overloaded method match for 'Kendo.Mvc.UI.Fluent.GridEditingSettingsBuilder<KendoGridMvcCodeFirst.Models.Customer>.Mode(Kendo.Mvc.UI.GridEditMode)' has some invalid arguments

I guess the issue is related to MvcContrib, because same code works in my another test application. My view page code look like this:

@(Html.Kendo().Grid<KendoGridMvcCodeFirst.Models.Customer>()
    .Name("Customers")
    .ToolBar(tb => tb.Create())
        .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable()
        
    .DataSource(dataSource => dataSource.Ajax()
            .Batch(true)
        .Model(model => model.Id(c => c.CustomerID))
        .Read("GetCustomers", "Home")
        .Update("UpdateCustomer", "Home")
        .Create("InsertCustomer", "Home")
        .Destroy("DeleteCustomer", "Home"))
    .Columns(cols =>
    {
        cols.Bound(c => c.CustomerID).EditorTemplateName("Integer");
        cols.Bound(c => c.Name).Width(300);
        cols.Bound(c => c.Phone);
        cols.Bound(c => c.Email);        
        cols.Command(cmd =>
        {
            cmd.Edit();
            cmd.Destroy();
        });
    })
)

Please help.

Thanks,
ARIF
Ariful
Top achievements
Rank 1
 asked on 13 Oct 2012
0 answers
118 views
Hi,

Does Kendo UI complete for MVC components such as Grid support RTL?
Arash
Top achievements
Rank 1
 asked on 13 Oct 2012
2 answers
755 views
All,

I've put together a sample application using Kendo UI for ASP.NET MVC at: Kendo UI ASP.NET Sample Applications

I've also written an article sharing my experience of putting together the sample application at: Kendo UI for ASP.NET MVC : Building a Forum Browser

I'll be putting together more sample applications as soon as I can!

Happy coding :-)

Regards,

John DeVight
John DeVight
Top achievements
Rank 1
 answered on 12 Oct 2012
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
ColorPicker
DateRangePicker
Security
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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?