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

How to send parameters with listview request?

6 Answers 378 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Parthasarathi
Top achievements
Rank 1
Parthasarathi asked on 01 Mar 2013, 05:54 PM
Hi All,

I am trying to pass parameters to controller action method from listview. But mvc controller action is not firing.. Script is below.
   
    <script type="text/x-kendo-tmpl" id="titletemplate">
                <div class="titleClass">
                <input type='checkbox' class='titleCheck' id=${CplGuid}  value=${aaaa}" > ${bbbb} </div>            
                </script>
                @(Html.Kendo().ListView<Dcip.KeyVault.Portal.Areas.KeyVaultUI.Models.DownloadKdmPE>()
        .Name("titles")
                        //.Events(events => events.DataBound("OnKeyDataBound"))
        .TagName("div")
        .ClientTemplateId("titletemplate")
        .DataSource(source =>
        source.Read(
        read => read.Action("xxxx", "yyyy").Data("filterTitles"))
        .PageSize(25)
        )       
        .Selectable(selection =>
        {
            selection.Enabled(true);
            selection.Mode(ListViewSelectionMode.Multiple);
        })
                        //.Pageable(pager => { pager.PageSizes(true); pager.ButtonCount(1); })
        .Pageable(pager => { pager.PageSizes(new int[] { 10, 20, 25 }); pager.ButtonCount(1); })
        )

<script type="text/javascript">
 function filterTitles() {
        alert('Hi Titles');
        return { xxId: 1 ,yyId:1 };
    }
</script>


Immediate help would be appreciated.

Regards,
Partha.

6 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 05 Mar 2013, 12:48 PM
Hello Partha,

Your code looks completely valid and the ListView should perform request to fetch the data from the action method which you specified. Are there any JavaScript errors in the console?

If there are not, could you put this into a small project so we can see what goes wrong?

Kind regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 25 Apr 2013, 06:26 PM
Any update on this?  I am having the exact same issue.  I know the javascript method for the data parameters fires, because I have an alert as well.  However, the controller is never hit.  If I remove the .Data(...) part, the controller is hit and returns data.
0
Daniel
Telerik team
answered on 29 Apr 2013, 01:26 PM
Hello,

Please check the response from the server. There is probably an exception thrown and the response message should indicate what is causing the problem.

Kind regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 29 Apr 2013, 01:30 PM
There is no response from the server, because the method to retrieve the data is never being called when I have .Data(...) on the Action.
0
Daniel
Telerik team
answered on 29 Apr 2013, 03:41 PM
Hello David,

I am not sure what is causing the problem in this case. Are there any JavaScript errors? If there are not any errors, could you check the attached sample project and let me know if I am missing something?

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 29 Apr 2013, 06:20 PM
So, my issue turns out that my controller method's additional parameter was named "filter".  This is apparently the problem due to the Kendo object using a property of that name.  Changing my parameter name fixed it.  Thank you for the sample. It helped.
Tags
ListView
Asked by
Parthasarathi
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
David
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or