Click here to Skip to main content
15,884,085 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in view:
<tbody>
                              @foreach (var item in Model.CallListModel)
                              {
                                  <tr>

                                      <td>
                                          <button onclick="FillCallDetails(@item.CallNumber)" type="button" style="border: none;background-color: white;" data-target="#myModal">
                                              @item.CallNumber
                                          </button>
                                      </td>

                                      @*<td onclick="FillCallDetails(@item.CallNumber)" class="mb-control" data-box="#message-box-warning" style="cursor:pointer">@item.CallNumber</td>*@
                                      <td>@Html.Raw(item.CallLogTime)</td>
                                      <td>@Html.Raw(item.EnggAssignTime)</td>
                                      <td>@Html.Raw(item.FieldActivities)</td>
                                      <td>@Html.Raw(item.Progress)</td>
                                  </tr>
                              }
                          </tbody>


function FillCallDetails(CallNumber) {
          debugger;
          $("#DivCallDetails").html("Please wait...");
          $.ajax({
              type: 'POST',
              url:  '../Master/CallDetails/',
              data: { CallNumber: CallNumber },
              success: function (Response) {
                  // alert(Response);
                  $("#myModal").show();
                  $("#DivCallDetails").html(Response);
              },
              error: function () {
                  alert("Failed");
              }
          });
      }




in controller:
public string CallDetails(string CallNumber)
      {
          StringBuilder sb = new StringBuilder();
          if (!string.IsNullOrEmpty(CallNumber))
          {
              SqlParameter[] Param = new SqlParameter[] { new SqlParameter("@CallNumber", SqlDbType.VarChar, 100) };
              Param[0].Value = CallNumber;
              string query = " sp_CallDetails_HpGsem";
              DataTable dt = DataLayer.MasterDashBoardDB.GetDataTable(ConfigurationManager.ConnectionStrings["Hp_server"].ConnectionString, CommandType.StoredProcedure, query, Param);
              if (dt.Rows.Count > 0)
              {

                  sb.Append("<div class='mb-content'>");
                  sb.Append("<p>");

                  if (dt.Rows[0]["SubCaseID"] != DBNull.Value)
                  {
                      sb.Append("Call Number : " + dt.Rows[0]["SubCaseID"] + " <br />");
                  }
                  if (dt.Rows[0]["BranchName"] != DBNull.Value)
                  {
                      sb.Append("Branch : " + dt.Rows[0]["BranchName"] + " <br />");
                  }
                  if (dt.Rows[0]["CustomerName"] != DBNull.Value)
                  {
                      sb.Append("Customer Name : " + dt.Rows[0]["CustomerName"] + " <br />");
                  }
                  if (dt.Rows[0]["CompanyName"] != DBNull.Value)
                  {
                      sb.Append("Customer Name : " + dt.Rows[0]["CompanyName"] + " <br />");
                  }
                 ["UserPhone"] + " <br />");
                  //}
                  if (dt.Rows[0]["Address"] != DBNull.Value)
                  {
                      //  sb.Append("Address : " + dt.Rows[0]["Address"] + " <br />");

                      string Address = "Address : " + dt.Rows[0]["Address"] + "";

                      if (dt.Rows[0]["CityName"] != DBNull.Value)
                      {
                          Address += ", " + dt.Rows[0]["CityName"] + "";
                      }

                      //if (dt.Rows[0]["StateName"] != DBNull.Value)
                      //{
                      //    Address += ", " + dt.Rows[0]["StateName"] + "";
                      //}
                      if (dt.Rows[0]["Pin"] != DBNull.Value)
                      {
                          Address += ", " + dt.Rows[0]["Pin"] + " <br /> ";
                      }
                      sb.Append(Address);
                  }

                  if (dt.Rows[0]["Problem"] != DBNull.Value)
                  {
                      sb.Append("Problem : " + dt.Rows[0]["Problem"] + " ");
                  }
                  sb.Append("</p>");
                  sb.Append("</div>");

              }
          }
          return sb.ToString();
      }


What I have tried:

actually when i click on CallNumber it will call method using jquery ajax..
it work but the problem is it is passing the round up value of CallNumber to controller method. like my id is 412232311-961. so it pass callnumber id to method like 4122334 like this. round up value
Posted
Updated 4-Apr-17 19:42pm
v2

1 solution

try this
onclick="FillCallDetails('@item.CallNumber')"

add quotes to the parameter, since it is a string.
 
Share this answer
 
v2
Comments
Member 12300036 5-Apr-17 2:07am    
thanku so much.
Karthik_Mahalingam 5-Apr-17 2:19am    
if it works please close this post.
Member 12300036 5-Apr-17 2:14am    
i need one more help..have u read my this question
https://www.codeproject.com/Questions/1180150/How-to-download-file-that-is-on-another-server-in

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