Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Telerik grid:
HTML
 <%Html.Telerik().Grid<SMS.Models.Appoint>(Model.Clist)
               .Name("StudentAttendance")
               .DataKeys(k => k.Add(v => v.student_Id).RouteKey("id"))
               .Columns(columns =>
               {
                   columns.Bound(c => c.sid).Title("&nbsp;&nbsp;S.No").Width(30).HtmlAttributes(new { Style = "text-align:center" });
                   columns.Bound(c => c.student_ADId).Title("&nbsp;&nbsp;Student ID").Width(50).HtmlAttributes(new { Style = "text-align:center" });
                   columns.Bound(c => c.studentName).Title("Student Name").Width(60).HtmlAttributes(new { Style = "text-align:left" });
                   columns.Bound(c => c.calssname).Title("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Class ").Width(40).HtmlAttributes(new { Style = "text-align:center" });              
                   columns.Bound(c => c.sectionname).Title("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Section").Width(60).HtmlAttributes(new { Style = "text-align:center" });                
                   columns.Bound(c => c.cudate).Title("&nbsp;&nbsp;Attendance Date").Format("{0:dd/MM/yyyy}").Width(70).HtmlAttributes(new { Style = "text-align:center" });
                  columns.Template(c => {%>
                 <select name="checkedRecords" lang="<%=c.student_Id%>">
                <option value="P" >Present</option>
                <option value="A" style="color:Red">Absent</option></select>             
               <%}).Width(70)
                .HeaderHtmlAttributes(new { style = "text-align:center" })
                    .HeaderTemplate("Attendance Status");                   
                   columns.Template(c =>
                 {%>
                  <select name="checkedRecords1" lang="<%=c.student_Id%>"> 
                  <option value="F" >Full-Day</option>
                  <option value="H" >Half-Day</option></select>            
               <%}).Width(70) 
                .HeaderHtmlAttributes(new { style = "text-align:center" })
                .HeaderTemplate("Present Status");                  
               }).HtmlAttributes(new { style = "text-align:center" })
               .Sortable()
             //  .Pageable(pagerAction => pagerAction.PageSize(10))
               .Scrollable()         
               .Render();
             %>
i stored in db Attendance process for student..here present status & day status not properly stored in db.
<pre lang="JavaScript">var $checkedRecords = $(&#39;select[name=checkedRecords]&#39;);
               var date = $(&quot;#dob&quot;).val();
               if (date != &quot;&quot;) {
                   for (var i = 0; i &lt; $checkedRecords.length; i++) {
                       var stuid = $checkedRecords[i].lang;
                       var sval = $checkedRecords[i].value;
                       var status = &quot;Attendance&quot;;
                       var len = $checkedRecords.length;
                       alert(1);
                       Process(stuid, date, sval, status, len);
                   }
                   var $checkedRecords1 = $(&#39;select[name=checkedRecords1]&#39;);
                   for (var i = 0; i &lt; $checkedRecords1.length; i++) {
                       var stuid = $checkedRecords1[i].lang;
                       var sval = $checkedRecords1[i].value;
                       var status = &quot;Present&quot;;
                       var len = $checkedRecords1.length;
                       alert(2);
                       Process(stuid, date, sval, status, len);
                   }
               }
               else {
                   alert(&quot;Select the Attendance Date&quot;);
               }
           });
           function Process(stuid, date, sval, status, len) {
               $.ajax({
                   type: &quot;GET&quot;,
                   url: &#39;&lt;%= Url.Content(&quot;~/&quot;) %&gt;&#39; + &quot;Appoinment/SaveStudentAttendance&quot;,
                   data: &quot;&amp;student_id=&quot; + stuid + &quot;&amp;date=&quot; + date + &quot;&amp;present_sts=&quot; + sval + &quot;&amp;status=&quot; + status + &quot;&amp;length=&quot; + len,
                   success: function (data) {
                       if (data.e.msg1 == &quot;1&quot;) {
                           window.location.href = &quot;/Appoinment/StudentAttendance/&quot; + data.e.msg1;
                       }
                   }
               });
           }            </pre>


here remove alert means not stored properly.every students showing alert.
Wat i do ..
Posted
Comments
F-ES Sitecore 7-Dec-15 9:33am    
I might be an issue with your web method not being able to process multiple requests at the same time, or it could be timing....you fire off 5 requests but there is no guarantee the order they occur in so if one is returning "1" then the page will be directed meaning maybe they others won't fire.

At the end of the day we can't really help. You haven't defined what "doesn't work" means and you don't seem to have done any debugging or diagnostics yourself. We can't run your code so we don't know what it is doing, try adding logging or breakpoints, or examine the database access using a profiler, and examine the network calls using Fiddler and see if you can work out from that what is happening.
Member 10735337 8-Dec-15 0:22am    
send any sample of code

1 solution

Have you tried using columns.Bound(c => c.classname) as an alternative to columns.Bound(c => c.calssname) in the fourth Columns.bound line? :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900