簡體   English   中英

用戶代碼未處理HttpCompileException(當我在腳本中添加C#代碼時)

[英]HttpCompileException was unhandled by user code (when i am adding c# code in script)

我有一個.aspx表單,我想在其運行時在e網格上顯示。 我為我的網格寫了一個腳本,該腳本有5列..在某個地方只需要顯示4列,我就不會通過使用if條件來使用它。

在我的腳本中,我還需要檢查條件是否..,我不知道如何在腳本中很好地添加該C#代碼。 任何人都可以幫助我解決這個問題嗎?

我的網格代碼..,

 <fieldset>
    <legend>
        <%=Labels.Labels.Encounter%></legend>

    <table class="zeebra sortable fwTable EncounterSearchDiv" id="EncounterTable" name="EncounterSearch"
        border="1">
        <thead>
            <tr>
                <th style="cursor: pointer;">
                    <%=Labels.Labels.PatientName%>
                </th>
                <th style="cursor: pointer;">
                    Status
                </th>
                 <%if (commonClassUtil.User.Role.Name != RoleType.FrontDesk)
                   {%>
                <th style="cursor: pointer;">
                    <%=Labels.Labels.EncounterSearch%>
                </th>
                <%} %>
                <th style="cursor: pointer;">
                    <%=Labels.Labels.Date%>
                </th>
                <th style="cursor: pointer;">
                    <%=Labels.Labels.VisitId%>
                </th>
                <%--<th style="cursor:pointer;"><%=Labels.Labels.EncounterId%></th>
            <th style="cursor:pointer;"> <%=Labels.Labels.FromDate%> </th>
            <th style="cursor:pointer;"><%=Labels.Labels.ToDate%> </th>
                <th style="cursor:pointer;"> PID</th>
                <th style="cursor:pointer;"><%=Labels.Labels.PatientName%></th>
                <th style="cursor:pointer;">Dentist/Hygienist</th>
                <th style="cursor:pointer;"><%=Labels.Labels.Location%></th>
                <th style="cursor:pointer;"><%=Labels.Labels.SSN%> </th>
                <th class="sorttable_nosort"><%=Labels.Labels.Action%></th>
                <th style="cursor:pointer;">Status</th>--%>
            </tr>
        </thead>
        <tbody>
            <%
                foreach (PatientRecord patientRecord in ViewData.Model.EncounterDetails)
                {
            %>
            <tr>
                <td>
                    <u><a href="#" onclick="window.location='/Emr/Patients/Show?PID=<%=patientRecord.Patient.Id%>';">
                        <%= CommonUtil.DisplayFormattedName(patientRecord.Patient.FirstName,patientRecord.Patient.MiddleName,patientRecord.Patient.LastName)%></a></u>
                </td>
                <td style="width: 115px;">
                    <%  string patientVisitStatus = "";
                        patientVisitStatus = CommonUtil.GetPatientVisitStatus(patientRecord.PatientVisitStatus);
                        if (patientVisitStatus != "Completed")
                        {
                            patientVisitStatus = "Open";
                        }      
                    %>
                    <%=patientVisitStatus %>
                </td>
                <%if (commonClassUtil.User.Role.Name != RoleType.FrontDesk)
                  {%>
                <td style="width: 300px;">
                    <%if (patientVisitStatus == "Completed")
                      {%>
                    <select id="EncounterStatus<%=patientRecord.Id%>" name="Status" style="font-size: 11px;
                        width: 171px;" >
                        <option value="0">--Select--</option>
                        <%if (ViewData.Model.UserDetails != null)
                          {%>
                        <%foreach (User operatoryType in ViewData.Model.UserDetails)
                          { %>
                        <%if (operatoryType.FirstName != null && operatoryType.FirstName.ToString() != "")
                          {%>
                        <option value="<%=operatoryType.Id%>">
                            <%=operatoryType.FirstName.Trim() + " " + operatoryType.LastName.Trim()%>
                        </option>
                        <%} %>
                        <%} %>
                        <%} %>
                    </select>
                    <%if (ViewData.Model.EncounterRequestDetails.Where(al => al.PatientRecord.Id == patientRecord.Id && al.RequestStatus == "Approved").Count() > 0)
                      {

                          var pinq = ViewData.Model.EncounterRequestDetails.Where(al => al.PatientRecord.Id == patientRecord.Id && al.RequestStatus == "Approved").Select(al => al.PIN).FirstOrDefault();  
                    %>
                    <script type="text/javascript">
                    debugger;
                        var e = document.getElementById("EncounterStatus"+<%=patientRecord.Id%>);
                        e.disabled=true;
                       e.value=<%=ViewData.Model.EncounterRequestDetails.Where(al => al.PatientRecord.Id == patientRecord.Id && al.RequestStatus == "Approved").Select(al => al.RequestTo).FirstOrDefault()%>;
                    </script>
                    <a id="OverrideRequest<%=patientRecord.Id%>"  class="tu_fl_iframe_600x500 tip button"
                        title="" onclick="CheckStatus(<%=patientRecord.Patient.Id%>,'Approved', <%=patientRecord.Id%>,<%=pinq%>);">
                        Approved</a>
                    <%} %>
                    <% else if (ViewData.Model.EncounterRequestDetails.Where(al => al.PatientRecord.Id == patientRecord.Id && al.RequestStatus == "Pending").Count() > 0)
                    { %>
                    <a id="OverrideRequest<%=patientRecord.Id%>" class="tu_fl_iframe_600x500 tip button"
                        title="" onclick="CheckStatus(<%=patientRecord.Patient.Id%>,'Request Sent', <%=patientRecord.Id%>,null);">
                        Request Sent</a>
                    <%}%>
                    <% else if (ViewData.Model.EncounterRequestDetails.Where(al => al.PatientRecord.Id == patientRecord.Id && al.RequestStatus == "Rejected").Count() > 0)
                    { %>
                    <a id="OverrideRequest<%=patientRecord.Id%>" class="tu_fl_iframe_600x500 tip button"
                        title="" onclick="CheckStatus(<%=patientRecord.Patient.Id%>,'Rejected', <%=patientRecord.Id%>,null);">
                        Rejected</a>
                    <%}%>
                    <% else
                    {%>
                    <a id="OverrideRequest<%=patientRecord.Id%>" class="tu_fl_iframe_600x500 tip button"
                        title="" onclick="CheckStatus(<%=patientRecord.Patient.Id%>,'Pending', <%=patientRecord.Id%>,null);">
                        Override</a>
                    <%}
                      }%>
                </td>
                <%} %>
                <td>
                    <%=(patientRecord.DateOfServiceFrom != null && patientRecord.DateOfServiceFrom.ToString() != "1/1/1753 12:00:00 AM") ? DateTimeUtil.GetFormattedDate(patientRecord.DateOfServiceFrom) : ""%>
                </td>
                <td>
                    <%=patientRecord.Id %>
                </td>
                <%-- <td><%=patientRecord.Id %></td>
     <td><%=(patientRecord.DateOfServiceFrom != null && patientRecord.DateOfServiceFrom.ToString() != "1/1/1753 12:00:00 AM") ? DateTimeUtil.GetFormattedDate(patientRecord.DateOfServiceFrom) : ""%></td>
        <td> <%=(patientRecord.DateOfServiceTo != null && patientRecord.DateOfServiceTo.ToString() != "1/1/1753 12:00:00 AM") ? DateTimeUtil.GetFormattedDate(patientRecord.DateOfServiceTo) : ""%></td>

            <td><%= patientRecord.Patient.PatientMRN%></td>
            <td><a href="#" onclick="window.location='/Emr/Patients/Show?PID=<%=patientRecord.Patient.Id%>';"><%= CommonUtil.DisplayFormattedName(patientRecord.Patient.FirstName,patientRecord.Patient.MiddleName,patientRecord.Patient.LastName)%></a></td>
            <td><%= CommonUtil.DisplayFormattedName(patientRecord.Physician.FirstName, patientRecord.Physician.MiddleName, patientRecord.Physician.LastName)%></td>
            <td><%=patientRecord.Location.Name%></td>
            <td><%=patientRecord.Patient.Ssn %></td>
            <td>
            <%=Html.ActionLink<PatientRecordsController>(c => c.ShowPatientRecord(patientRecord.Id), " ", new { @class = "detailsButton", title = "patient Record Details" })%>

            <%CommonClassUtil commonClassUtil = CommonClassUtil.GetCommonClassUtil();
              UtilityDto utilityDto = commonClassUtil.UtilityDto; %>

            <%if (utilityDto.RoleName == RoleType.OfficeManager || utilityDto.RoleName==RoleType.FrontDesk){ %>
            <%=Html.ActionLink<WaitingRoomController>(c => c.ShowPaymentDetails(patientRecord.Id), " ", new { @class = "paymentDetails", title="View Payment Details" })%>
            <%} %>

            </td>
            <td style="width: 115px;">
       <%string patientVisitStatus = "";
        patientVisitStatus= CommonUtil.GetPatientVisitStatus(patientRecord.PatientVisitStatus); 
         if(patientVisitStatus.Equals("In Clinician Waiting Room",StringComparison.OrdinalIgnoreCase))
        {
          patientVisitStatus="In Waiting Room";
        }      
        %>
        <%=patientVisitStatus %>      

</td>--%>
            </tr>
            <%} %>
        </tbody>
    </table>
</fieldset>

我的腳本代碼

 <script type="text/javascript">
    $(function () {
        debugger;
  var a=" <%CommonClassUtil commonClassUtil = CommonClassUtil.GetCommonClassUtil(); %> ";
       <%?????????%>
        //$('#TAB-12').addClass('selected');
        oTable = $('.EncounterSearchDiv').dataTable({
            "aaSorting": [[0, "asc"]],
            "bPaginate": true,
            "bLengthChange": true,
            "bFilter": true,
            "bSort": true,
            "bInfo": true,
            "bAutoWidth": true,
            "bRetrieve": true,
            "bDestroy": true,
            "aoColumns": [
     null,
     null,
     null,
     null,
     null]
        });
    });

我通過使我的代碼像tis來解決了我的問題

<%=Html.Hidden("User",CommonClassUtil.GetCommonClassUtil().User.Role.Name)%>
 <script type="text/javascript">
    $(function () {
        debugger;
        var user = document.getElementById('User').value;

       if (user != "Front Desk" )
          {

        //$('#TAB-12').addClass('selected');

            oTable = $('.EncounterSearchDiv').dataTable({
                "aaSorting": [[0, "asc"]],
                "bPaginate": true,
                "bLengthChange": true,
                "bFilter": true,
                "bSort": true,
                "bInfo": true,
                "bAutoWidth": true,
                "bRetrieve": true,
                "bDestroy": true,
                "aoColumns": [
                         null,
                         null,
                         null,
                         null,
                         null]
            });

            }else{
             oTable = $('.EncounterSearchDiv').dataTable({
                "aaSorting": [[0, "asc"]],
                "bPaginate": true,
                "bLengthChange": true,
                "bFilter": true,
                "bSort": true,
                "bInfo": true,
                "bAutoWidth": true,
                "bRetrieve": true,
                "bDestroy": true,
                "aoColumns": [
                         null,
                         null,
                         null,
                         null
                        ]
            });

           } 

    });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM