Telerik Forums
UI for ASP.NET MVC Forum
3 answers
1.1K+ views
I read this Page.
( http://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config
 http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/autocomplete/overview)

My Test Source: 
vs2012 , AdventureWorks2012Db, Person Table, Ef5,  KendoUIMvcApplication.
 
@(Html.Kendo().AutoComplete()
   .Name("test") //The name of the autocomplete is mandatory. It specifies the "id" attribute of the widget.
   .DataTextField("FirstName") //Specifies which property of the Product to be used by the autocomplete.))
   .BindTo(Model)   //Pass the list of Products to the autocomplete.
   .Filter("contains") //Define the type of the filter, which autocomplete will use.
 )



Georgi Krustev
Telerik team
 answered on 04 Jan 2016
1 answer
134 views

Hi

I am working through some Telerik sample code and having some errors. I am trying to understand how it works in order to troubleshoot the problem.

Specifically, I am using a ComboBox widget with an id value (let's call it comboID) which is set in the .Name property.

 

 Now this code from the sample:

$(comboID).each(function () {

eval($(this).children("script").last().html());

});

I think adds a new combo box. What does the ("script") keyword signify?

Now I need to find the ComboBox and update the selected item. 


$(comboID).data().kendoComboBox.value(status);

But get undefined for the kendoComboBox. I'm not sure what this line does. I assume we are looking into the DOM but what is the type that is returned?

Thanks for your help. Just trying to understand.

Nencho
Telerik team
 answered on 04 Jan 2016
1 answer
120 views

I have a dropdown inside a grid which currently takes 100% width of the column. Because of number of columns, width of this column is very less compared to the length of each item I have for the dropdown.

I want to make the options list of the dropdown to display full text in single line with out increasing the width of the column. I am using white-space:nowrap to get the text in online but the options list gets  scroll bar. Is there a way that I can increase its width to 100%?

Iliana Dyankova
Telerik team
 answered on 04 Jan 2016
1 answer
131 views
Are there any detailed useful map tutorials? I don't much care to show roads, but I would like to show sales data.  Color states different colors based on sales figures in those states.  Colored states showing percentages of coverage within any given year.  Actual useful maps that pertain to data in a database?
Joe
Top achievements
Rank 1
 answered on 31 Dec 2015
2 answers
228 views

I am following this tutorial here and created a page but popup won't show when I click the button. I am getting javascript error sys is undefined. 

Tutorial: http://demos.telerik.com/aspnet-ajax/window/examples/modalpopup/defaultcs.aspx

aspx

 

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FNA.NRTT.Website.Customer.Portfolio.Default" %>
<%@ Register TagPrefix="nrtt" TagName="CustomerGrid" Src="~/UserControls/CustomerGrid.ascx" %>
<%@ Register TagPrefix="nrtt" TagName="DisplayClientDefinedField" Src="~/UserControls/DisplayClientDefinedField.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <h2><asp:Literal ID="ltPageTitle" runat="server" Text="<%$ Resources:NrttLanguage, Portfolio %>"></asp:Literal></h2>
    <nrtt:DisplayClientDefinedField runat="server" ID="ucDisplayCDFS" OnNeedCdfDefinitions="ucDisplayCDFS_NeedCdfDataDefinition" OnFilterChanged="ucDisplayCDFS_FilterCDFS"/>
    <asp:Button ID="rbEdit" Text="Edit" runat="server"/>
    <nrtt:CustomerGrid ID="ucExpiringRealServices" runat="server" AllowSelection="true" OnNeedDataSource="ucExpiringRealServices_NeedDataSource" OnNeedColumnCollection="ucExpiringRealServices_NeedColumnCollection" OnItemDataBound="ucExpiringRealServices_ItemDataBound" ></nrtt:CustomerGrid>
    <telerik:RadWindow ID="modalPopup" runat="server" Width="360px" Height="360px" Modal="true" OffsetElementID="main">
        <ContentTemplate>
            <div style="padding: 10px; text-align: center;">
                <telerik:RadButton ID="rbToggleModality" Text="Toggle modality" OnClientClicked="togglePopupModality"
                    AutoPostBack="false" runat="server" Height="65px" />
            </div>
            <p style="text-align: center;">
                RadWindow is designed with keyboard support in mind - try tabbing
                    before and after removing the modal background. While the popup is modal
                    you cannot focus the text area, once the modality is removed the text area will
                    be the first thing to receive focus because it has tabIndex=1.
            </p>
        </ContentTemplate>
    </telerik:RadWindow>
     
</asp:Content>

 

javascript:

var demo = {};
 
function togglePopupModality() {
    var wnd = getModalWindow();
    wnd.set_modal(!wnd.get_modal());
 
    if (!wnd.get_modal()) {
        document.documentElement.focus();
    }
}
function showDialogInitially() {
    var wnd = getModalWindow();
    wnd.show();
    Sys.Application.remove_load(showDialogInitially);
}
Sys.Application.add_load(showDialogInitially);
 
function getModalWindow() { return $find(demo.modalWindowID); }
 
global.$modalWindowDemo = demo;
global.togglePopupModality = togglePopupModality;

Pavlina
Telerik team
 answered on 30 Dec 2015
1 answer
341 views

I have a kendo grid in a kendo PanelBar (actually, I have a few kendo grids in a few kendo panelbars in the same page), and to eliminate a long load time, I don;t want to actually retrieve the grids data until the specific PanelBar get's expanded.  I figured out the Expand event, but how do I configure my Grid to get the data based on that event?

 

<ul id="panelbar">
    <li id="item1">
        <b>Names</b>
        <div id="SampleNamesGrid"></div>
 
        @(Html.Kendo().Grid<SampleName>().Name("SampleNamesGrid")
              .TableHtmlAttributes(new {@class = "table-condensed"})
              .Columns(c =>
              {
                  c.Bound(sn => sn.ID);
                  c.Bound(sn => sn.FirstName);
                  c.Bound(sn => sn.LastName);
              })
              .DataSource(d => d
                  .Ajax()
                  .Read(r => r.Action("GetNames", "SampleNames").Type(HttpVerbs.Get))
                  .PageSize(20)
              )
              .Pageable()
              .Filterable()
              .Sortable())
    </li>
</ul>
 
<script>
    $("#panelbar").kendoPanelBar({
        expand: Expand
    });
 
    function Expand(e) {
        alert("open");
    }
</script>
Joe
Top achievements
Rank 1
 answered on 30 Dec 2015
1 answer
10.5K+ views
<div> 
    <hr />
    <h2 style="color: orangered">@ViewBag.EquipmentType</h2>
    <p>@Html.ActionLink("Back", "GetEquipmentTypes", "Lookup", null, new { @style = "color: orangered;" })</p>

    @(Html.Kendo().Grid<UtiliPoleOfficeWeb.Models.EquipmentModel>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Name).Width(150);
        columns.Bound(p => p.Description).Width(160);
        columns.ForeignKey(p => p.Category, (System.Collections.IEnumerable)ViewData["categories"], "Id", "Name").Width(120).HeaderHtmlAttributes(new { @title = "Category" }).Width(140).EditorTemplateName("EquipmentTypeCategoryList");
        columns.Bound(p => p.Type).Width(100).EditorTemplateName("EquipmentTypeList").Title("Type").ClientTemplate("#:Type#");
        columns.Bound(p => p.Height).Width(50);
        columns.Bound(p => p.Width).Width(50);
        columns.Bound(p => p.Length).Width(50);
        columns.Bound(p => p.Obsolete).Width(75);
        columns.Command(command => { command.Edit(); });
    })
    .ToolBar(toolBar =>
    {
        toolBar.Create();

    })
    .Editable(editable => { editable.Mode(GridEditMode.InLine); })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Resizable(r => r.Columns(true))
    .HtmlAttributes(new { style = "height: 650px; width: 1000px;" })
    .ColumnResizeHandleWidth(10)
    .DataSource(dataSource => dataSource
        .Ajax()
        .ServerOperation(false)
        .Events(events => events.Error("error_handler"))
        .Model(model =>
        {
            model.Id(p => p.Id);
            model.Field(p => p.Name);
            model.Field(p => p.Category);
            model.Field(p => p.Type);
            model.Field(p => p.Height);
            model.Field(p => p.Width);
            model.Field(p => p.Length);
            model.Field(p => p.Description);
            model.Field(p => p.Obsolete);
        })
        .PageSize(20)
        .Read(read => read.Action("EquipmentByType_read", "EquipmentType").Data("additionalInfo"))
        .Create(create => create.Action("EquipmentByType_Create", "EquipmentType"))
        .Update(update => update.Action("EquipmentByType_Update", "EquipmentType"))
            //.Destroy(destroy => destroy.Action("EquipmentByType_Destroy", "EquipmentType"))
    )
    )
</div>
    <script>

        $(document).ready(function () {

            $("#grid .k-grid-content").css("overflow-y", "scroll").css("overflow-x", "scroll").scroll(function () {
                var left = $(this).scrollLeft();
                var wrap = $("#grid > .k-grid-header-wrap");
                if (wrap.scrollLeft() != left) wrap.scrollLeft(left);
            });

            return;
        });

    </script>

    This code will produce the scroll bar rectangle with the right and left arrows with no bar to scroll with, because the grid control re-sizes the columns smaller so they all fit (crumbled up)  inside the width of 1000 px as I defined explicitly. One post was apparently happy with a reply that his total column width should be smaller than the container width but if that's the case, you don't need the scroll bar

If I redefine my container width to 550 px the scroll bar shows up but presentation looks nasty as the column are resized smaller and the container is way to small. 

I've also tried the following approach

    <script>

        $(document).ready(function () {

            $("#grid .k-grid-content").css("overflow-y", "scroll").css("overflow-x", "scroll").scroll(function () {
                var left = $(this).scrollLeft();
                var wrap = $("#grid > .k-grid-header-wrap");
                if (wrap.scrollLeft() != left) wrap.scrollLeft(left);
            });


            resizeColumn('', '60px');
            resizeColumn('Obsolete', '75px');
            resizeColumn('Length', '50px');
            resizeColumn('Width', '50px');
            resizeColumn('Height', '50px');
            resizeColumn('Type', '100px');
            resizeColumn('Category', '120px');
            resizeColumn('Description', '160px');
            resizeColumn('Name', '150px');

            return;
        });

        function resizeColumn(title, width) {
            var index = $("#grid .k-grid-header-wrap").find("th:contains(" + title + ")").index();

            $("#grid .k-grid-header-wrap") //header
                .find("colgroup col")
                .eq(index)
                .css({ width: width });

            $("#grid .k-grid-content") //content
                .find("colgroup col")
                .eq(index)
                .css({ width: width });

            return;
        }

    </script>

    But this made the presentation look even worse.

Please Help, anybody ...

 




Aaron
Top achievements
Rank 1
 answered on 30 Dec 2015
3 answers
1.6K+ views

I have a grid with an InCell edit and I have one of the columns as a dropdown list and I'm implementing this using EditorTemplateName. I'm getting the dropdown list populated but how do I have the default value of the dropdown selected to the bound column value? Now I just get a dropdown on clicking the cell with all the values populated and the default selected value is blank.

 My Editior Template :

 

@model IEnumerable<AMCUpfrontTracker2.Models.Agency_Ref>

@(Html.Kendo().DropDownListFor(m => m)
        .DataValueField("AgencyID")
        .DataTextField("AgencyName")
        .BindTo((System.Collections.IEnumerable)ViewData["Agencies"])
)

 

 

 

Raja
Top achievements
Rank 1
 answered on 29 Dec 2015
3 answers
180 views

Hi,

 I was wondering if there is a way to disable child check boxes when parent check boxes have been disabled. I have used the selectableMode property to disable parent checkbox but am running into issue disabling child checkbox using same property.

 C#:

//This is for disabling child checkbox
 
protected void BindChildGrid(GridDataItem parentItem)
 
        {
            var ucQuoteRows = parentItem.ChildItem.FindControl("ucExpiringRealServices") as UserControls.CustomerGrid;
            CheckBox checkBox = (CheckBox)parentItem["BulkActionSelect"].Controls[0];
             
            if (ucQuoteRows != null)
            {
                checkBox.Attributes.Add("data-customergridid", ucQuoteRows.ClientID);
                //var envelopeName = parentItem.GetDataKeyValue("Name");
                ucQuoteRows.ParentId = parentItem.GetDataKeyValue("ObjectId").ToString();
                /*ucQuoteRows.ExportFileNamePrefix = envelopeName.ToString();
                ucQuoteRows.TaInfoEnable = RoleEngine.CurrentUserHasTARead();*/
                //BindCustomerGrid(ucQuoteRows, null);
                if (parentItem.SelectableMode == GridItemSelectableMode.None)
                {
                    ucQuoteRows.AllowSelection = false;
                }
                else if (parentItem.SelectableMode == GridItemSelectableMode.ServerAndClientSide)
                {
                    ucQuoteRows.AllowSelection = true;
                }
                ucQuoteRows.ColumnCollection = null;
                ucQuoteRows.Rebind();
            }
        }
 
  
 
//this correctly disables parent checkbox
protected void rgExpiringServices_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                 
                var dataItem = ((GridDataItem)e.Item);
                var ObjectId = Guid.Parse(dataItem.GetDataKeyValue("ObjectId").ToString());
 
                e.Item.SelectableMode = this.DisabledIds.Contains(ObjectId) ? GridItemSelectableMode.None : GridItemSelectableMode.ServerAndClientSide;
 
            }
        }

aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ExpiringServices.aspx.cs" Inherits="FNA.NRTT.Website.Customer.Service.ExpiringServices" %>
<%@ Register TagPrefix="nrtt" TagName="CustomerGrid" Src="~/UserControls/CustomerGrid.ascx" %>
<%@ Register TagPrefix="nrtt" TagName="DisplayClientDefinedField" Src="~/UserControls/DisplayClientDefinedField.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <h2><asp:Literal ID="ltPageTitle" runat="server" Text="<%$ Resources:NrttLanguage, Services %>"></asp:Literal></h2>
 
    <asp:DropDownList ID="ddlInterval" runat="server" style="text-align:right" OnSelectedIndexChanged="ddlInterval_SelectedIndexChanged" AutoPostBack="true">
        <asp:ListItem Text="30 days" Value="0" />
        <asp:ListItem Text="90 days" Value="1" />
        <asp:ListItem Text="Forever" Value="2" />
    </asp:DropDownList>
    <br />
    <nrtt:DisplayClientDefinedField runat="server" ID="ucDisplayCDFS" OnNeedCdfDefinitions="ucDisplayCDFS_NeedCdfDataDefinition" OnFilterChanged="ucDisplayCDFS_FilterCDFS"/>
    <telerik:RadGrid ID="rgExpiringServices" OnNeedDataSource="rgExpiringServices_NeedDataSource" OnItemCommand="rgExpiringServices_ItemCommand" AllowFilteringByColumn="true" OnPreRender="rgExpiringServices_PreRender" runat="server" Skin="Black" AllowMultiRowSelection="true" OnItemDataBound="rgExpiringServices_ItemDataBound" AllowPaging="true">
        <ClientSettings Selecting-AllowRowSelect="true" Selecting-UseClientSelectColumnOnly="true" ClientEvents-OnRowSelected="nestedGridRowSelected" ClientEvents-OnRowDeselected="nestedGridRowDeselected"></ClientSettings>
        <MasterTableView DataKeyNames="ObjectId, Name" AutoGenerateColumns="false" ShowFooter="true" HierarchyLoadMode="ServerOnDemand" EnableHierarchyExpandAll="true" AllowFilteringByColumn="true">
            <Columns>
                <telerik:GridClientSelectColumn UniqueName="BulkActionSelect" HeaderText="<%$ Resources:NrttLanguage, BulkAction %>" ></telerik:GridClientSelectColumn>
                <telerik:GridButtonColumn ButtonType="ImageButton" ButtonCssClass="btnTiny btnApprove" UniqueName="Renew" CommandName="Renew" ImageUrl="~/Images/blank16.png" HeaderStyle-Width="16px" ItemStyle-Width="16px" ></telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="ImageButton" ButtonCssClass="btnTiny btnDelete" UniqueName="Terminate" CommandName="Terminate" ImageUrl="~/Images/blank16.png" HeaderStyle-Width="16px" ItemStyle-Width="16px" ></telerik:GridButtonColumn>
                <telerik:GridNumericColumn UniqueName="Name" DataField="Name" HeaderText="<%$ Resources:NrttLanguage, CustomerReference %>" DataType="System.String"> </telerik:GridNumericColumn>
                <telerik:GridDateTimeColumn DataField="DateExpiration" DataType="System.DateTime" FilterControlAltText="Filter DateImportant column" HeaderText="<%$ Resources:NrttLanguage, DateExpiring%>" SortExpression="DateImportant" UniqueName="DateImportant" DataFormatString="{0:d}" >
                </telerik:GridDateTimeColumn>
                <telerik:GridNumericColumn UniqueName="Daysuntilexpired" DataField="DaysUntilExpiration" HeaderText="<%$ Resources:NrttLanguage, daysuntilexpired %>" > </telerik:GridNumericColumn>
                <telerik:GridBoundColumn UniqueName="Services" DataField="ServiceInReferenceString" HeaderText="<%$ Resources:NrttLanguage, Services %>" ></telerik:GridBoundColumn>
                <telerik:GridNumericColumn UniqueName="Parcelcount" DataField="RealInReference" HeaderText="<%$ Resources:NrttLanguage, ParcelCount %>" > </telerik:GridNumericColumn>
            </Columns>
            <NestedViewTemplate>
                <nrtt:CustomerGrid ID="ucExpiringRealServices" runat="server" AllowSelection="true" OnNeedDataSource="ucExpiringRealServices_NeedDataSource" OnNeedColumnCollection="ucExpiringRealServices_NeedColumnCollection" OnItemDataBound="ucExpiringRealServices_ItemDataBound" ></nrtt:CustomerGrid>
            </NestedViewTemplate>
        </MasterTableView>
    </telerik:RadGrid>
    <div style="text-align:right">
        <asp:RadioButton ID="Extend" Text="Extend" Checked="true" GroupName="whattodo" runat="server" />
        <asp:RadioButton ID="Terminate" Text="Terminate" Checked="false" GroupName="whattodo" runat="server" />
        <telerik:RadButton ID="rbtnSubmitSelection" runat="server" Text="<%$ Resources:NrttLanguage, RequestPayment %>" Skin="Black" SingleClick="true" OnClick="rbtnSubmitSelection_Click"></telerik:RadButton>
    </div>
</asp:Content>

Konstantin Dikov
Telerik team
 answered on 29 Dec 2015
3 answers
121 views

can someone tell me why this is not working? I am trying to puss the ID of the video to GetVideoDuration().

<script type="text/x-kendo-template" id="template">
 
   <div class="duration"
        @{string VID = "VID";}                                                            
        @VID.Replace("Vimeo_ID", "${VID}")
        @MultimediaController.GetVideoDuration(VID)
    </div>
 
</script>

Second line display the correct VID on every record. But when  GetVideoDuration() is getting executed the value passed is VID string not the actual number.

multimedia controller.

public static string GetVideoDuration(string VID)
{
            string strDuration = string.Empty;
}

Dimiter Madjarov
Telerik team
 answered on 25 Dec 2015
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
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
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?