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

Client Edit Template DropDownList not being passed as parameter to update ajax binding method

2 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
KooterB
Top achievements
Rank 1
KooterB asked on 17 Jan 2011, 12:59 AM
I am getting a null value passed to my ajax   .Update("_SaveAjaxEditing", "AptProfile") in my controller when using the dropdownlist client Edit Template.

property in my FormViewModel that my grid is bound to:

'Format Code Block'(   [UIHint("BuildingsGrid"), Required]
        [DisplayName("Building ID")]
         public int BuildingID
        {
            get;
            set;
        }).


'Format Code Block'(     <%= Html.Telerik().Grid<PayRent.Models.AptProfileFormViewModel1>()
                    .Name("Profiles")
                    .DataKeys(dataKeys => dataKeys.Add(c => c.AptProfileID))
                                    .ToolBar(commands => commands.Insert())
                    .DataBinding(binding => 
                        {
                            binding.Ajax()
                            .Select("GetProfiles", "AptProfile")
                            .Insert("_InsertAjaxEditing", "AptProfile")
                            .Update("_SaveAjaxEditing", "AptProfile")
                            .Delete("_DeleteAjaxEditing", "AptProfile");
                        
                        })
                                        
                    .Columns(columns => 
                    {
                        columns.Bound(o => o.AptProfileID);
                        columns.Bound(o => o.BuildingID);
                        columns.Bound(o => o.AptID);
                        columns.Bound(o => o.AptRate);
                        columns.Bound(o => o.AptSize);
                        columns.Bound(o => o.MoveInDate);
                        columns.Command(s =>
                        {
                            s.Edit();
                            s.Delete();


                        });
                    
                    
                    })
                                    .Editable(editing => editing.Mode(GridEditMode.InLine))
                                    .ClientEvents(events => events.OnEdit("onEdit"))
                    .Pageable()
            %>
    </p>

 <script type="text/javascript">

function onEdit(e) {
//            $(e.form).find('#BuildingsGrid').data('tDropDownList').select(function (dataItem) {
//                return dataItem.Text == e.dataItem['BuildingGrid'];
//            });
        }


    </script>

)


My EditTemplate:

'Format Block Code'(<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%= Html.Telerik().DropDownList()
        .Name("BuildingsGrid")
            .BindTo(new SelectList((IEnumerable)ViewData["Buildings"], "BuildingID", "Name"))
%>)



2 Answers, 1 is accepted

Sort by
0
Prathamesh
Top achievements
Rank 1
answered on 21 Apr 2011, 08:30 AM

Hi Friend, I am experiencing the same problem. I couldn't get selected value of DropDownList on Client Edit Template at controller side. While editing it's unable to call the action which has 2 parameters one is id and other is value from dropdownlist. Have you found the workaround please let me know. Really, searched a lot for the answer. Any help will be appreciated.

Thanks.

0
Supriya
Top achievements
Rank 1
answered on 16 Mar 2013, 07:59 AM
Hi..

I'm facing the same problem.
I'm getting a textbox instead of dropdown list.
Can anyone help as soon as possible???

Thank you.
Have a good day !!
Tags
Grid
Asked by
KooterB
Top achievements
Rank 1
Answers by
Prathamesh
Top achievements
Rank 1
Supriya
Top achievements
Rank 1
Share this question
or