Telerik Forums
UI for ASP.NET MVC Forum
1 answer
435 views

Hi all,

I started working with Blazor few weeks ago and recently got introduced to Telerik UI for Blazor so I started making a CRUD to learn.

After coding the update function I tested the app and got this error when I tried to update a register:

The instance of entity type 'Familia' cannot be tracked because another instance with the same key value for {'CodiFamilia'} is already being tracked.

To solve that I added "AsNoTracking" to the Entity Framework Core query located in "ReadList", it worked the first time but the app crashed after the second update. Afterwards I implemented an alternative solution which consists on finding the object by its ID and updating every parameter one by one which worked since it's not using the same object.

I'm wondering if there is any way to implement a functional update which resembles the first solution because the second one is pretty bad if there are many parameters to update azarshagle.

Thanks in advance.

Jack
Top achievements
Rank 1
 updated question on 16 Dec 2021
2 answers
92 views

Hello,

 

is it possible to open a modal view and show a remote HTML page of PDF Document inside the modal view content?
I only see, that you can add own html in the "Content" Block.

 

If its not possible with the modal view, is there any control that allows me to do that. I would like to show HTML pages or PDFs in a "non fullscreen window", which should be on top of my main window. So modal window would be perfect ...

 

Greetings

Dimitar
Telerik team
 answered on 30 Jan 2020
2 answers
119 views

Anyone know why my MobileModalView form appears for a split second on my page load? It's a stripped down version with no style, but it appears and then goes away. I modified the ModalMobileView demo to test the basics of the MobileModalView feature and included a form and some a few other small changes. Could the addition of a form cause this some how?

Here's my cshtml:

 @{

    Layout = "~/Views/Shared/_LayoutMobile.cshtml";

}


@model MyProjectWeb.Models.LoginModel




@(Html.Kendo().MobileView()
        .Name("modalview-camera")
        .Title("MyProject")
        .Content(
        @<text>

            <img src="@Url.Content("~/Content/photos/NewLogoTrimmed.JPG")" class="camera-image" style="width: 100%; height: 100%;" />
<br/>
<br />
<br />
<br />
<br />
<br />
            @(Html.Kendo().MobileButton()
                        .Text("Login")
                        .Name("modalview-open-button")
                        .Rel(MobileButtonRel.ModalView)
                        .Url("#modalview-login")
            )
        </text>)
)

@(Html.Kendo().MobileModalView()
       .Name("modalview-login")
       .HtmlAttributes(new { style = "width: 95%; height: 18em;" })
       .Header(obj =>
           Html.Kendo().MobileNavBar()
                .Content(navbar =>
                    @<text>
                        <span>Login</span>
                        @(Html.Kendo().MobileButton()
                            .Text("Cancel")
                            .Align(MobileButtonAlign.Right)
                            .Events(events => events.Click("closeModalViewLogin"))
                        )
                    </text>)
        )
        .Content(
        @<text>
            @ModalViewContentTemplate()
        </text>)
)

@helper ModalViewContentTemplate()
{
    using (Html.BeginForm("LogOn", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) {

        
        
    @(Html.Kendo().MobileListView().Style("inset")
                .Items(items =>
                {
                    items.Add().Content(
                        @<text>
                            @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })
                            @Html.TextBoxFor(m => m.UserName, new { @class = "form-control" })
                            @Html.ValidationMessageFor(m => m.UserName, "", new { @class = "text-danger" })
                        </text>);
                    items.Add().Content(
                        @<text>
                            @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
                            @Html.PasswordFor(m => m.Password, new { @class = "form-control" })
                            @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" })
                        </text>);
                    items.Add().Content(
                        @<text>
                            <input class="k-checkbox" data-val="true" data-val-required="The Remember Me field is required." id="IsPersistent" name="IsPersistent" type="checkbox" value="true">
                            <label class="k-checkbox-label" for="IsPersistent">Remember Me</label>
                            <input name="IsPersistent" type="hidden" value="false">
                        </text>);
                })
        )
    
        @(Html.Kendo().MobileButton()
                    .Text("Login")
                    .Name("modalview-login-button")
                    .Events(events => events.Click("closeModalViewLogin"))
        )
        @*@(Html.Kendo().MobileButton()
                    .Text("Register")
                    .Name("modalview-reg-button")
                    .Events(events => events.Click("closeModalViewLogin"))
        )*@
        
    }
}
<style>


    #modalview-login-button,
    #modalview-reg-button,
    #modalview-open-button {
        display: block;
        text-align: center;
        margin: .6em .8em 0;
        font-size: 1.2em;
    }

    #modalview-open-button {
        margin: 0 3em;
        padding: .5em;
    }

    .km-flat #modalview-open-button {
        color: #fff;
    }

    #modalview-camera {
        text-align: center;
    }

        #modalview-camera img {
            display: block;
            margin: 30px auto;
        }

        #modalview-camera .km-content,
        .km-ios #modalview-login .km-content {
            /*background: url(../../content/shared/images/patterns/pattern1.png) repeat 0 0;*/
        }

    .km-ios #modalview-camera .km-button,
    .km-ios #modalview-login .km-button,
    .km-ios #modalview-camera .km-navbar,
    .km-ios #modalview-login .km-header {
        background-color: #000;
    }

        .km-ios #modalview-camera .km-button:active,
        .km-ios #modalview-camera .km-state-active,
        .km-ios #modalview-login .km-button:active,
        .km-ios #modalview-login .km-state-active {
            background-color: #2e2e2e;
        }

    .km-ios #modalview-login #modalview-login-button,
    .km-flat #modalview-login #modalview-login-button {
        background-color: Green;
        color: #fff;
    }

    .km-tablet .km-ios #modalview-camera .km-view-title, .km-tablet .km-ios #modalview-login .km-view-title {
        color: #fff;
        text-shadow: 0 -1px rgba(0,0,0,.5);
    }
</style>

<script>
    function closeModalViewLogin() {
        $("#modalview-login").kendoMobileModalView("close");
    }
</script>

 

The _LayoutMobile is here:

<!DOCTYPE html>

<html>
<head>


    <title>@ViewBag.Title</title>


    <link href="~/Content/kendo/2015.2.805/kendo.mobile.all.min.css" rel="stylesheet" />
    <link href="~/Content/kendo/2015.2.805/kendo.common.min.css" rel="stylesheet" />
    <link href="~/Content/kendo/2015.2.805/kendo.default.min.css" rel="stylesheet" />
    
    

    @*<link href="~/Content/kendo/2015.2.805/kendo.mobile.ios.min.css" rel="stylesheet" />*@

    @*<link href="~/Content/kendo/2015.2.805/kendo.mobile.android.light.min.css" rel="stylesheet" />*@
    @*<link href="~/Content/kendo/2015.2.805/kendo.mobile.flat.min.css" rel="stylesheet" />*@

    @*<link href="~/Content/kendo/2015.2.805/kendo.mobile.ios.min.css" rel="stylesheet" />*@

    <script src="~/Scripts/kendo/2015.2.805/jquery.min.js"></script>
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/kendo.all.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/kendo.aspnetmvc.min.js")"></script>

    <script type="text/javascript" src="@Url.Content("http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js")"></script>
    <script type="text/javascript" src="@Url.Content("http://ajax.aspnetcdn.com/ajax/mvc/5.1/jquery.validate.unobtrusive.min.js")"></script>


    @*<script src="~/Scripts/jquery.timeago.js" type="text/javascript"></script>*@
    <script src="~/Scripts/moment-with-locales.js" type="text/javascript"></script>
    @*<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/kendo/2015.2.805/kendo.common.min.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/kendo/2015.2.805/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/kendo/2015.2.805/kendo.default.min.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/kendo/2015.2.805/kendo.dataviz.default.min.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/jquery.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/kendo.all.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo/2015.2.805/kendo.aspnetmvc.min.js")"></script>
    <script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>*@
    @RenderSection("HeadContent", false)

    @*using the bundles instead*@
    @*@Styles.Render("~/Content/test.css")*@

    @*@Scripts.Render("~/bundles/bootstrap")
    @Styles.Render("~/Content/css")*@

    @(Html.Kendo().MobileApplication()
        //.PushState(true)
        .ServerNavigation(true)
        //.Root("/mobile/")
        //.StatusBarStyle("black")
    )
</head>
<body>
  

    
    @RenderBody()

</body>
</html>

Petyo
Telerik team
 answered on 21 Jan 2016
0 answers
172 views
Found my answer here

I have declared the following in my Login.cshtml file.  Everything displays and accepts user input correctly.  However, the form submit button does nothing.  Is there a way to get it to work?

@model LoginModel

@{
    ViewBag.Title = "Login";
}

@(Html.Kendo().MobileView()
    .Name("view-login")
    .Title("Login")
    .Header(obj =>
        (Html.Kendo().MobileNavBar()
                .Name("nav")
                .Content(navbar =>
                    @<text>
                    @navbar.ViewTitle("")
                    </text>
                )
            )
        )
    .Content(
        @<text>
        @LoginForm()
        </text>
    )
    )
)

@helper LoginForm()
    {
    <section id="loginForm">
    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)

        <fieldset>
            <legend>Log in Form</legend>
            <ol>
                <li>
                    @Html.LabelFor(m => m.UserName)
                    @Html.TextBoxFor(m => m.UserName)
                    @Html.ValidationMessageFor(m => m.UserName)
                </li>
                <li>
                    @Html.LabelFor(m => m.CompanyCode)
                    @Html.TextBoxFor(m => m.CompanyCode)
                    @Html.ValidationMessageFor(m => m.CompanyCode)
                </li>
                <li>
                    @Html.LabelFor(m => m.Password)
                    @Html.PasswordFor(m => m.Password)
                    @Html.ValidationMessageFor(m => m.Password)
                </li>
                <li>
                    @Html.CheckBoxFor(m => m.RememberMe)
                    @Html.LabelFor(m => m.RememberMe, new { @class = "checkbox" })
                </li>
            </ol>
            <input type="submit" value="Log in" />
        </fieldset>
    }
    </section>
}

@(Html.Kendo().MobileApplication()
    .ServerNavigation(true)
)

ADDITIONAL NOTES:

I determined that the cause of the malfunctioning Login button is the fact that the form produced by BeginForm is empty and reads as such:

<form action="/Account/Login" method="post"></form>

Any ideas why the form is coming up empty?
Steven
Top achievements
Rank 1
 asked on 26 Aug 2013
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
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
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
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
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?