Kendo has good feature to display the detail of any row or relevant child records using detail template. The example already exists in Kendo UI demo site.
example http://demos.kendoui.com/web/grid/detailtemplate.html
There have three different ways to display detail template for grid rows.
1. Server detail template:
If you make server binding in main grid using MVC wrapper then Server Detail Template is very good option to display child records or detail element for each grid row. Here it is very similar to adding a child control inside a grid using DetailTemplate(…) action. It also gives expression to write as razor MVC syntax.
Example :
2. Client Detail Template :
Some cases you need to display grid records on ajax call. Example of Datasource ajax call is:
1: .DataSource(dataSource => dataSource
2: .Ajax()
3: .Read(read => read.Action("Products_Read", "Home"))
4: )
In this case Server Detail Template will not work. Because main grid records are loaded by ajax call dynamically. To display detail template for ajax read call you need to use Client Detail Template .
The problem is that you need to know some kendo client template syntax. Here has example to write client template scripts ( if-else condition, for loop ) using kendo expression http://docs.kendoui.com/getting-started/framework/templates/overview
But You can still write MVC wrapper widget and at the end you have to call ToClientTemplate
to use it inside client template.
3. Hybrid Solution:
It is a mix solution of client detail template and using server call to render HTML . So I called this hybrid solution. Inside client script you can also make Javascript ajax call.
1: <script id="client-template" type="text/x-kendo-template">
2: <div id="placeholder">
3: <script>
4: $.get("url",function(data){
5: // do somethings
6: $(document.getElementById("placeholder)).html(data);
7: });
8: </script>
9: </script>
In this example I am making an simple Javascript ajax call to get data from server side ( calling MVC controller action). In server side through Partial View I am getting the html which is rendered in server side. Using this way you are getting full freedom to write code in MVC razor syntax and Kendo MVC wrapper though you are using client template. After getting html from server side the placeholder div is populated with the resultant HTML.
Note: Jquery element select option “$(‘#placeholder’) does not work as # is used also for Kendo syntax. so that I used document.getElementById.
For those that are interested, you can still use the jquery selector for this.
ReplyDeleteInstead of using: $(document.getElementById("placeholder")).html(data);
Use: $("\\#placeholder").html(data);
Using "\\" escapes the hash key character in the kendo controls. Other than that, thanks for this. I was trying to using @Html.RenderPartial() and it was constantly giving me errors, but this works just as well.
thanks for sharing your experience.
ReplyDeleteHi Syed,
ReplyDeleteI liked the approach.. can u paste a full working code here or any other site like jsfiddle.net.
I need to know how to figure out the Id of the parent row.
Thanks in advance
I have read your blog its very attractive and impressive. I like it your blog.
ReplyDeleteASP.NET MVC Training in Chennai
ASP.NET MVC Online Training | Online LINQ Training
Thanks for sharing useful information. I am giving best MVC online training in Hyderabad
ReplyDeleteMVC online training
online MVC training
asp.net with MVC training
MVC training
This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.
ReplyDeleteI like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
Java training in Chennai
Java training in Bangalore
Java online training
Java training in Pune
This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.
ReplyDeleteI like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
Java training in Chennai
Java training in Bangalore
Java online training
Java training in Pune
Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
ReplyDeletepython Online training in chennai
python training institute in marathahalli
python training institute in btm
Python training course in Chennai
Hmm, it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well as an aspiring blog writer, but I’m still new to the whole thing. Do you have any recommendations for newbie blog writers? I’d appreciate it.
ReplyDeleteAWS Course Interview Questions and Answers for Freshers | AWS Interviews Questions and Answers for Devops
AWS Interview questions and answers for Sysops |AWS Interview Question and Answers BlogSpot
The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
ReplyDeleteAWS Training in Bangalore
Wow!! Templates explanation is so good.I really understood.
ReplyDeleteJava training in Chennai
Java training in Bangalore
Java training in Hyderabad
Java Training in Coimbatore
Java Online Training
It is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot
ReplyDeletedata science training in chennai
data science training in tambaram
android training in chennai
android training in tambaram
devops training in chennai
devops training in tambaram
artificial intelligence training in chennai
artificial intelligence training in tambaram
Your info is really amazing with impressive content..Excellent blog with informative concept. Really I feel happy to see this useful blog
ReplyDeletesap training in chennai
sap training in annanagar
azure training in chennai
azure training in annanagar
cyber security course in chennai
cyber security course in annanagar
ethical hacking course in chennai
ethical hacking course in annanagar
This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.
ReplyDeleteI like it and help me to development very well.
hardware and networking training in chennai
hardware and networking training in omr
xamarin training in chennai
xamarin training in omr
ios training in chennai
ios training in omr
iot training in chennai
iot training in omr
Wow, that was informative. Thank you for sharing this. We are a Master MSP (simply put, IT Service and Support Providers) based in India and we have partnered with and served 75+ MSPs globally in the past 6 years. You can know more about us by visiting our
ReplyDeleteinfrassist
outlook rules not working
80090016
powershell script
script hub
join Microsoft Teams Meeting
Yeni Perde Modelleri
ReplyDeleteSms onay
türk telekom mobil ödeme bozdurma
nftnasilalinir.com
ankara evden eve nakliyat
Trafik Sigortasi
Dedektor
Site kurma
aşk kitapları
SMM PANEL
ReplyDeletesmm panel
İŞ İLANLARI
İnstagram takipçi satın al
Hirdavatci
beyazesyateknikservisi.com.tr
Servis
TİKTOK HİLE İNDİR
"Great article, felt good after reading, worth it.
ReplyDeletei would like to read more from you.
keep posting more.
also follow Propmtengineeringcourseinhyderabad"
nice work "Top Digital Marketing Agency In Hyderabad
ReplyDelete"