custom pop up editor for grid - dropdown list

3 posts, 0 answers
  1. Paul
    Paul avatar
    13 posts
    Member since:
    Sep 2015

    Posted 25 Sep 2015 Link to this post

    Hello everyone.

    I am doing a proof of concept with telerik mvc grid controls and am in the following situation.

    1. Using the Kendo Grid i am trying to do the following..

    a Popup Edit screen with a Custom template with a dropdown list that calls the controller for additional info.

    Here is the code i have so far 


        columns.ForeignKey(p => p.CASH_ISIN_CHR, (System.Collections.IEnumerable)ViewData["cashisnnames"], "ISIN_CHR", "Name_CHR").Title("CASH ISIN").EditorTemplateName("CashISINEditor");
        columns.ForeignKey(p => p.CURRENCY_ISIN_CHR, (System.Collections.IEnumerable)ViewData["currencyisnnames"], "ISIN_CHR", "Name_CHR").Title("CURRENCY ISIN").EditorTemplateName("CurrencyISINEditor");
        columns.Bound(c => c.Units_INT).Title("UNITS");
        columns.Bound(c => c.Local_Amount_DEC).Title("Local Amt");
        columns.Bound(c => c.Trade_DATE).Format("{0:d}").Title("Trade Date");
        columns.Bound(c => c.Settlement_DATE).Format("{0:d}").Title("Settle Date");
        columns.Bound(c => c.Custodian_Reference_Num_CHR).Title("Cust. Ref #");
        columns.Bound(c => c.Entered_DNT).Format("{0:d}").Title("Entered Date");
        columns.Bound(c => c.FX_Rate_DEC).Title("FX Rate");
        columns.Command(command => { command.Edit(); }).Width(180);
    .ToolBar(toolbar =>
    .Excel(excel => excel.FileName("Transaction Master Export.xlsx").AllPages(true)
    .Pdf(pdf => pdf.AllPages())
    .HtmlAttributes(new { style = "height:750px;" })
    .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("CustomTransactionMasterEditor"))

    I have an editor template called CustomTransactionMasterEditor and the code in it looks like this:

    @model BetaSMTRApp.Models.Transaction_Master
    <h3>Custom Transaction Master</h3>
    @Html.TextBoxFor(model => model.FUND_INT).ToString()
    @Html.TextBoxFor(model => model.TYPE_CHR)
    @(Html.Kendo().DropDownListFor(m => m)
            .DataSource(ds => ds
                    .Read(read => read.Action("GetCASHISIN", "TransactionMaster", new { FundInt = 223, TypeChr = "Expense" })

    In the TextBoxFor fields i am getting fund int and type chr... both of which i need to pass in the .Read on the data source line.  When i try to use Model it is null.

     How can i get the textbox for value into the new section of the .Read?





  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    2035 posts

    Posted 29 Sep 2015 Link to this post

    Hello Corey,


    I would suggest using the data method of the Kendo UI DataSource, which allows you to send additional information to the server along with the request. 


    In this forum thread you can find an example of using the data method for Kendo UI Grid for ASP.NET MVC. Same approach could be used for the Kendo UI DropDownList for ASP.NET MVC as well. 


    Since the data method will be executed before the edit event of the Kendo UI Grid widget you might not be able to retrieve the values of the text box fields. In order to overcome this problem I would suggest setting the AutoBind option for the DropDownList widget to false. This will allow the read operation ( and the data method will be fired) when user clicks on the DropDownList widget. At this time the text boxes will be already populated with data and their values could be accessed. 


    Boyan Dimitrov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Paul
    Paul avatar
    13 posts
    Member since:
    Sep 2015

    Posted 29 Sep 2015 in reply to Boyan Dimitrov Link to this post

    Thank you Boyan i will try what you have posted and get back to you.



Back to Top