Telerik Forums
UI for ASP.NET MVC Forum
4 answers
809 views
For usability, I need the users to be able to re-upload a file multiple times without having to select it again.  For example, a user can upload a file that my controller parses and determines there are formatting or schema issues with it.  The user will open the local file, fix the issue, and then upload it again.  I'd like them to be able to press a retry or upload button again without having to click the Select button, browse through their list of files to find it, and pick it again.

Is there any way to do this?  I've tried to leverage the client side upload and success events, but I've not been able to figure it out.

I can use my own Upload button (using css to hide the built in one) if there is a way for me to tell the control to start the upload in javascript.  However, I don't know if the control will still have a handle on the file to upload after it has done it successfully once already.  Also, I am currently using Async mode (AutoUpload = false), but if there is a way to do it using Sync mode then I am open to trying it.

Any ideas?

Thanks.
T. Tsonev
Telerik team
 answered on 17 Jun 2013
2 answers
341 views
Hello,

I have a grid that display a date. The controller send to the grid the dates in the right format 'dd/mm/yyyy hh:mm:ss'  but the grid displays dates such as  'Sun, 09 Mar 2008 16:05:07 GMT 0200 (Romance Daylight Time)'.  Is it possible to set the default format in french without reformating the data?
PS: i set the culture in french.


@(Html.Kendo().Grid<Scan>(Model)
                .Name("grid_Time_" + ViewData["ID"])
                .Columns(columns =>
                             {
                                  
                                 columns.Bound(e =>  e.Timestamp).Title("Date").Width(150).Format("{0:dd/MM/yyyy hh:mm:ss}");
                                 columns.Bound(e => e.GatewayID).Width(20);
                             })
                .Sortable()
                .Pageable()
                .ClientDetailTemplateId("template2")
                .DataSource(dataSource => dataSource
                          .Ajax()
                          .PageSize(30)
                          .Model(model =>
                                      {
                                          model.Id(d => d.GatewayID);
 
                                      })
 
                )
                .Events(events => events.DataBound("dataBound"))
                )

I have a client template which is loading with two values :
.Read(read => read.Action("ReadScannedMeterByGateway", "Flottes", new { Id = "#=GatewayID#",Timestamp="#=Timestamp#" }))
How can i send the dates with the format 'dd/mm/yyyy hh:mm:ss'  to server?
Farid
Top achievements
Rank 1
 answered on 17 Jun 2013
2 answers
885 views
I am using json for comment on post where i use kendo ui editor for summary. on success json i am trying to clear editor value by jquery like $('#editor').val(' ');
its not working.If i remove kendo editor its working fine. please help.
Kris Nobels
Top achievements
Rank 2
 answered on 17 Jun 2013
1 answer
117 views
Hi:

Yesterday I downloaded  Kendo UI for a trial.  I was able to install without any errors that I could see, but when I try to run the demo in VS2010 SP1 I  have the following issues:
 
1: Message at start: "Attaching the script debugger to process ... iexplore.exe on machine ... failed.  A debugger is already attached.  There are no other VS or Dev Server instances running.  This error is not crucial as I can proceed with the demos.

2. When I navigate to the Treeview with remote data demo, the only thing I see above the sources after delay is "Request Failed" with a retry button.

3.  It appears some of the sources are missing including these references from Index.cshtml:
<link href="@Url.Content("~/Content/shared/suite.css")" rel="stylesheet">v
<a href="@(Url.RouteUrl("RazorDefault", new { controller = "Suite", suite = "web" }))" class="imgPlate"><img src="@Url.Content("~/Content/shared/demos-web.png")" /></a>  (both the class and the png are missing.  In fact the Content folder is empty.)

4. In the grid binding to local data at line 3 in  c:\Program Files (x86)\Telerik\Kendo UI for ASP.NET MVC Q1 2013\wrappers\aspnetmvc\Examples\Areas\razor\Views\web\grid\local_data.cshtml, the code  @(Html.Kendo().Grid(Model)... gets a "The system cannot find the file specified" error.

Except for the first item, the errors are the same whether I start in VS or just click on the demo link in the  windows menus. 

The simpler examples mostly work, but what I need Kendo UI for is databinding against remote data, mostly with the grid and treeview, so I really need working examples of these,.  It appears that the demo that comes in the Kendo MVC MSI has not been properly QAed.  Or possibly there is some other cause on my machine.  Is there another source of these demos that I can try?  or can you help me resolve these issues?

Thanks,

Terry






Atanas Georgiev
Telerik team
 answered on 17 Jun 2013
1 answer
128 views
Hi,

I have a dropdownlistfor that uses templates to display an image for each dropdown entry

I am having trouble retrieving the correct data.

   @(Html.Kendo().DropDownListFor(model => model.Image0Id)
                    .DataSource(source =>
                    {
                        source.Read(read =>
                        {
                            read.Action("GetImageIds", "Home");
                            read.Type(HttpVerbs.Post);
                        });
                    })
                    .Template("<img src='" + @Url.Action("GetImage", "Home", new { imageId = "#=data#"}) + "' width='128' height ='51'/>")
                    .OptionLabel("None")
                    .AutoBind(true)
                )

The #=data# is actually returning my ViewModel so when pass value to GetImage() I have a problem.
If I replace #=data# with say the number 2, the template works and fetches my image with id of 2.
If I insert some javascript #{alert(data)#} to alert me of the data values returned by GetImageIds() it returns the expected values.

I am using this in a similar scenario elsewhere where my template is as follows:
.Template("<img src='" + @Url.Content("~/Images/Banners/#=data#") + "' width='128' height ='51'/>")

This works perfectly.

Anybody have any ideas here?
 
John
Top achievements
Rank 1
 answered on 17 Jun 2013
3 answers
343 views
Hi,

I have two kendo grids which needs to be placed side by side (Both the grids uses same controller method).

My requirements.

1. Have to load >50000 rows(shouldn't take much time to load).
2. Scrolling should be in sync.
3. Paging should not be applied.
4. Column width should be auto.
5. Row height should be same for both the grids so that scrolling make sense.

Please share a demo on this.
Dimo
Telerik team
 answered on 17 Jun 2013
8 answers
1.2K+ views
I'm creating a Kendo.Mvc.UI.Menu in a Html Helper.  If the current controller/action matches the menu item then i set Selected to true. However, when the menu gets rendered to the page the current menu item is not selected.  Is there an init or onload event that is ignoring or overriding the Selected property?  It seems to only effect the current controller/action, if i set other menu items to Selected = true, they will stay selected.

Kendo.Mvc.UI.Menu menu = Kendo.Mvc.UI.HtmlHelperExtension.Kendo(helper).Menu();
menu.Name = "MainMenu";
  
IList<MenuItem> items = new List<MenuItem>();
  
items.Add(new MenuItem { Text = "Dashboard", Action = "Index", Controller = "Dashboard" });
items.Add(new MenuItem { Text = "Certificates", Action = "Index", Controller = "Certificates" });
  
UrlHelper Url = new UrlHelper(helper.ViewContext.RequestContext);
string controller = helper.ViewContext.RouteData.GetRequiredString("controller");
  
foreach (MenuItem item in items)
{
      menu.Items.Add(new Kendo.Mvc.UI.MenuItem { Url = Url.Action(item.Action,item.Controller),Text = item.Text, Selected = (item.Controller == controller)});
}
  
return new MvcHtmlString(menu.ToHtmlString());

Sorry, still transitioning from Telerik.Mvc...

Thanks,
Chris
Kendo MVC Version: v4.0.30319
Eric
Top achievements
Rank 1
 answered on 16 Jun 2013
4 answers
575 views
I can't seem to get remote validation to work in my popup edit window.  Normal validation ([Required] etc) seems to work fine, but the remote call to the JsonResult method isn't working.  In a plain MVC view for the same model the remote validator works as expected.

Here is the grid (most irrelevant columns removed)
@(Html.Kendo().Grid<UserModel>()
      .Name("Users")
      .ToolBar(commands => { commands.Create().Text("Create new User"); })
      .Columns(columns =>
      {
          columns.Bound(o => o.uidIdentity).Hidden();
          columns.Bound(o => o.UserName).Title("Users Name").Sortable(true).Filterable(true).Width(200)
              .HeaderHtmlAttributes(new { style = "text-align:center;align=center" }).HtmlAttributes(new { style = "text-align:center;align=center" });
          columns.Bound(o => o.Email).Title("Email Address ").Sortable(true).Filterable(true).Width(175)
              .HeaderHtmlAttributes(new { style = "text-align:center;align=center" }).HtmlAttributes(new { style = "text-align:center;align=center" });
 
      })
      .Events(events => events.DataBound("UserGrid_DataBound").Edit("UserGrid_edit"))
      .ClientDetailTemplateId("roleTemplate")
      .Sortable()
      .Editable(editing =>
          editing.Mode(GridEditMode.PopUp).Window(w => w.HtmlAttributes(new { })))
      .DataSource(dataSource => dataSource
        .Ajax()
        .Events(e => e.Error("error_handler"))
        .Read("_GetTpaUser", "User")
        .Create("_InsertUser", "User")
        .Update("_EditUser", "User")
        .Destroy("_DeleteUser", "User")
        .Model(model => model.Id(o => o.UserName))
        )
      .Filterable()
      .Scrollable(scroll => scroll.Enabled(true).Height(500))
      .Resizable(resize => resize.Columns(true))
      .Pageable(pager => pager.PageSizes(true))
)

Here is the controller JsonResult:

public JsonResult UserNameExists(string UserName)
{
    AccountRepository _repository = new AccountRepository();
    if (!(_repository.CheckUserNameExists(UserName)))
        return Json(true, JsonRequestBehavior.AllowGet);
    else
        return Json(string.Format("User name: {0} is already in use.", UserName), JsonRequestBehavior.AllowGet);
 
}

Here is the model (irrelevant fields removed):

public class UserModel
    {
        #region Constructor
        public UserModel()
        {
            
        }
        #endregion
        private AccountRepository _reposAcct = new AccountRepository();
        private spGetUserProfileResult _UserProfile = new spGetUserProfileResult();
 
        public Guid UserGuiD { get; set; }
        public int UserID { get; set; }
        [Required(ErrorMessage = "First Name Required")]
        [DisplayName("First Name:")]
        public string FirstName
        {
            get
            {
                return _UserProfile.FirstName;
            }
            set
            {
                _UserProfile.FirstName = value;
            }
        }
        [Required(ErrorMessage = "Last Name Required")]
        [DisplayName("Last Name:")]
        public string LastName
        {
            get
            {
                return _UserProfile.LastName;
            }
            set
            {
                _UserProfile.LastName = value;
            }
        }
 
      
        
        [Required(ErrorMessage = "User Name Required")]
        [Remote("UserNameExists", "AddUserLogin", "Administration")]
        [DisplayName("User Name:")]      
        public string UserName { get; set; }
        [Required(ErrorMessage = "Email Address Required")]
        [ValidateEmail(ErrorMessage = "A valid email address is required")]
        [DataType(DataType.EmailAddress)]
        [DisplayName("Email Address:")]
        public string Email { get; set; }
}

This identical model works fine in a standard scaffold generated view.  Any ideas?
Henrik
Top achievements
Rank 1
 answered on 16 Jun 2013
4 answers
649 views
Hi,
I have put in a general error handling to handle exceptions and authorisation errors for all Ajax calls, both Kendo and my api. I send back status 500 of exception and 401, Forbidden, or 403, Unauthorized, for authorisation errors.

The problem is I do not seem to be able to prevent the dataSource from updating the display if I get a non-200, OK, response. Looking at the code in Chrome it does not call the function associated with 'databinding' on line 13 of the code below.
01.function kendoGridErrorHandler(args) {
02.    if (args.errors == undefined) {
03.        if (args.xhr.status == 403) {
04.            updatePrimaryMessage("You are not authorised to carry out that operation.", true);
05.        } else if (args.xhr.status == 401) {
06.            updatePrimaryMessage("You need to be logged in to carry out that operation.", true);
07.        } else if (args.xhr.status == 500) {
08.            updatePrimaryMessage("The operation did not complete because of an error.", true);
09.        } else {
10.            updatePrimaryMessage("There was problem. Please refresh the screen.", true);
11.        }
12.        $('#PrimaryKGrid').data().kendoGrid.one('dataBinding', function(e) {
13.            e.preventDefault();
14.        });
15.    } else {
16.        //error means Ajax error response. customerror means Kendo error response
17.        var grid = $('#PrimaryKGrid').data("kendoGrid");
18.        grid.one("dataBinding", function(e) {
19.            e.preventDefault(); // cancel grid rebind if error occurs
20.            //We have formatted errors to display
21.            for (var error in args.errors) {
22.                showMessage(grid.editable.element, error, args.errors[error].errors);
23.            }
24.        });
25.    }
26.}
Can you suggest what I have done wrong?

Thanks in advance.
Jon Smith
Top achievements
Rank 1
 answered on 14 Jun 2013
3 answers
782 views
I am migrating an application from release 2012.3.1114 to release 2013.1.319.  Previously, I was able to apply HtmlAttributes on columns in this manner:
@(Html.Kendo().Grid<ToolListItemView>().Name("texListGrid")
    .Columns(columns => {
        columns.Bound(m => m.ToolId);
        columns.Bound(m => m.Description).HtmlAttributes(new { style = "font-size: 1.3em;" });
        columns.Bound(m => m.LastModified);
        columns.Bound(m => m.ConditionName);
        columns.Bound(m => m.LocationName);
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("ToolsRead", "List").Data("listParams"))
    )
)
With release 2013.1.319, an "invalid template" error is generated from the above code.  If I change HtmlAttributes to HeaderHtmlAttributes, no errors are generated and the style is applied to the column header (i.e. the format of the HtmlAttributes isn't a problem).  I did verify that I could use HtmlAttibutes on a column with an @class parameter successfully, which is the correct way of applying styles.  I guess I'm wondering if this capability (local CSS styling via HtmlAttributes) was intentionally removed, or if I'm doing something wrong?

Note: Moved from Kendo UI Web forum.
Dimo
Telerik team
 answered on 14 Jun 2013
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?