如何解决这个Pblm? [英] how to solve this Pblm?

查看:99
本文介绍了如何解决这个Pblm?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Telerik网格:

 <% Html.Telerik()。网格< 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)。宽度( 30 )。HtmlAttributes( new {Style = text- align:center});
columns.Bound(c => c.student_ADId)。标题( & nbsp;& nbsp;学生ID)。宽度( 50 )。HtmlAttributes( new {Style = text-align:center});
columns.Bound(c => c.studentName)。标题( 学生姓名)。宽度( 60 )。HtmlAttributes( new {Style = text-align:left});
columns.Bound(c => c.calssname)。标题( & nbsp;&  & nbsp;& nbsp;& nbsp; Class)。宽度( 40 )。HtmlAttributes( new {Style = text-align:center});
columns.Bound(c => c.sectionname)。标题( & nbsp;&  & nbsp;& nbsp;& nbsp;& nbsp;& nbsp; Section)。宽度( 60 )。HtmlAttributes ( new {Style = text-align:center });
columns.Bound(c => c.cudate)。标题( & nbsp;&出席日期)。格式( {0:dd / MM / yyyy})。宽度( 70 )。HtmlAttributes( new {Style = text-align:center});
columns.Template(c => {%>
< select name = checkedRecords lang = <% = c.student_Id%> >
< 选项 value = P > 目前< ; / option >
< 选项 < span class =code-attribute> value = A style = 颜色:红色 > 缺席 < / option > < / select >
<%})。宽度( 70
.HeaderHtmlAttributes( new {style = text-align:center})
.HeaderTemplate( 出席状态);
columns.Template(c =>
{%>
< 选择 名称 = checkedRecords1 lang = <% = c.student_Id%> >
< 选项 value = F > 全天< / option >
< 选项 value = H > 半日< / option > < / select >
<%})。宽度( 70
.HeaderHtmlAttributes(< span class =code-keyword> new
{style = text-align:center})
.HeaderTemplate( 现状);
})。HtmlAttributes( new {style = text-align:center})
.Sortable()
// .Pageable(pagerAction => pagerAction.PageSize(10))
.Scrollable()
.Render();
%>
我存储在数据库出勤过程中为学生..目前状态&日期状态未正确存储在db中。
< pre < span class =code-attribute> 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;出勤率& quot ;;
var len = $ checkedRecords.length;
alert(1);
流程(stuid,date,sval,status,len);
}
var $ checkedRecords1 = $(&#39;选择[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);
流程(stuid,date,sval,status,len);
}
}
else {
alert(& quot;选择出勤日期& quot;);
}
});
函数进程(stuid,date,sval,status,len){
$ .ajax({
type:& quot; GET& quot;,
url:& #39;& lt;%= Url.Content(& quot;〜/& quot;)%& gt;&#39; +& quot; Appoinment / SaveStudentAttendance& quot;,
数据:& 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 /& amp; quot; + data.e.msg1 ;
}
}
});
} < / pre >





这里删除警报意味着没有正确存储。每个学生都显示警报。

我做的..

解决方案

checkedRecords =


(&#39;选择[name = checkedRecords]&#39;) ;
var date =


(& quot;#dob& quot;)。val();
if(date!=& quot;& quot;){
for(var i = 0; i & lt;

Telerik grid:

 <%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 ..

解决方案

checkedRecords =


(&#39;select[name=checkedRecords]&#39;); var date =


(&quot;#dob&quot;).val(); if (date != &quot;&quot;) { for (var i = 0; i &lt;


这篇关于如何解决这个Pblm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆