This is a migrated thread and some comments may be shown as answers.

custom pop up editor for grid - dropdown list

2 Answers 221 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 25 Sep 2015, 05:59 PM

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);
})
.ClientDetailTemplateId("template")
.ToolBar(toolbar =>
{
    toolbar.Excel();
    toolbar.Pdf();
})
.Excel(excel => excel.FileName("Transaction Master Export.xlsx").AllPages(true)
)
.Pdf(pdf => pdf.AllPages())
.ColumnMenu()
.HtmlAttributes(new { style = "height:750px;" })
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("CustomTransactionMasterEditor"))
.Pageable()

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)
        .Name("cashisndd")
        .DataValueField("ISIN_CHR")
        .DataTextField("Value")
         
        .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?

 

Thanks,

 

Corey

2 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 29 Sep 2015, 08:52 AM

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. 

 

Regards,
Boyan Dimitrov
Telerik
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
0
Paul
Top achievements
Rank 1
answered on 29 Sep 2015, 04:29 PM

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

Thanks,

Corey

Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Paul
Top achievements
Rank 1
Share this question
or