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

Hi

How do I pass a value from the button .content

@(Html.Kendo().Button()
                .Name("p14")
                 .HtmlAttributes(new { type = "button" })
                .Content("135")
                       .Events(ev => ev.Click("onClickPol")))
     <script>
    function onClickPol(e) {
       //This dos not work, I want to retrieve the name, content of that button what n this case is 135
        var xContent  = $(e.event.target).closest(".k-button").attr("textContent")

    }
    </script>

Dimiter Madjarov
Telerik team
 answered on 09 Jun 2015
3 answers
3.4K+ views
I am using kendo button the following way.

    @(Html.Kendo().Button().Name("deleteButton").HtmlAttributes(new { type = "button", @class = "k-primary pull-right" }).Content("Delete").Events(ev => ev.Click("Delete(1)")))

I need to call a javascript function with parameters

        function Delete(value)
        {
            alert(value)
        }

But it doesn't work when I click the button.
Everything works fine without arguments.

Does telerik support passing arguments to javascript functions from buttons?
Dimiter Madjarov
Telerik team
 answered on 20 Feb 2015
3 answers
262 views
I have a Kendo().Button on a page that, when clicked, fires a click event to open a Kendo().Window in order to display an alert.  This works fine.  But, if I add a $(document).ready function  to open the window when the document is ready, it does not open the window, and the button does not render properly.

Instead of rendering as a <button> with an <img> property, instead it renders as a plain <button> no image,

Code follows:

@{
                            if (@Model.IsClinicalAlert) {
                            @(Html.Kendo().Button()
                                .Name("redalertbutton")
                                .ImageUrl(Url.Content("~/img/patient_alert_red.bmp"))
                                .HtmlAttributes(new { type = "button" })
                                .Events(ev => ev.Click("onAlertClick")))
                            } else {
                                @(Html.Kendo().Button()
                                .Name("greenalertbutton")
                                .ImageUrl(Url.Content("~/img/patient_alert_green.bmp"))
                                .HtmlAttributes(new { type = "button" })
                                .Events(ev => ev.Click("onAlertClick")))
                            }
                            }
 
<script>
    $(document).ready(function () {
        if ($@Model.IsClinicalAlert) {
            alert(@Model.ClinicalAlert);
            var wdw = $("#alertWindow").data("kendoWindow");
            wdw.open();
        }
    });
 
    function onAlertClick(e) {
        var wdw = $("#alertWindow").data("kendoWindow");
        wdw.open();
    }
</script>
@(Html.Kendo().Window()
    .Name("alertWindow")
    .Title("Clinical Alert")
    .Content(@<text><strong>@Model.ClinicalAlert</strong></text>)
    .Draggable()
    .Resizable()
    .Width(400)
    .Modal(true)
    .Visible(false)
    .Position(settings => settings.Top(150).Left(250)))
Dimiter Madjarov
Telerik team
 answered on 06 May 2014
1 answer
283 views
I have a Kendo button with the click event defined as:

@(Html.Kendo().Button()
                    .Name("btnAddNewLineItem")
                    .Tag("span")
                    .Icon("plus")
                    .Content(@InvSubModule.Infrastructure.Localization.ResourceManager.GetString("AddNew") +"   " + "<span></span>")
                    .HtmlAttributes( new {type = "button"} )
                    .Events(ev => ev.Click("AddLineItemButtonRequest"))                 
                )   

In my JavaScript method: "AddLineItemButtonRequest", the last line sets the focus to another control on the page via jQuery:

$("#LineItemType").focus();

However, after this line, the focus is shifted back to the Kendo button above. Is there another way I should be setting the focus?

Thanks for your time,
Scott Dulock


Dimiter Madjarov
Telerik team
 answered on 26 Mar 2014
1 answer
44 views
Hello there

I need windows 8 opening style big rectangle effective buttons. (attached image). Does Kendo MVC UI provide any similar control?
 
Dimo
Telerik team
 answered on 30 Jan 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?