Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My controller :
C#
public ActionResult Index(string uid)
       {
           string u_Id = uid;
           return View(new IncidentModel().Incidents(u_Id));

       }


My view:
@using DirectTracIncident1.Models;
@{
ViewBag.Title = "Index";
}
@Styles.Render("content/incident.css")

<script type="text/javascript">
function ViewFunction() {
// $('#id').click(function()

var id=$('#myform').val();

$.ajax({
url: '@Url.Action("Index", "Home")',
type: 'GET',
UpdateTargetId: '#ajax',
data:form.serialize(),
success: function (data) {
alert(data);
}
})
}
</script>











Logout

<img src="images/cart1.png" />

<img src="images/phone.png" />

<img src="images/search_filter.png" />




Download

Live Demo








Home <img src="../../images/seperator.png"> Support <img src="../../images/seperator.png"> Direct-Trac <img src="../../images/seperator.png"> View Incidents




Incidents

New Incident

@using (Html.BeginForm(new{ id = "myform" }))
{


@Html.Label("User Id")


@Html.TextBox("uid")


<input id="btn" type="submit" value="submit" />


}




Incidents

Status



@foreach (var i in Model)
{


@i.title

platform:"@i.platFormName"

@i.statusName




}











My model:
public class IncidentModel
{
public string title { get; set; }
public string platFormName { get; set; }
public string statusName { get; set; }
//public string user_Id { get; set; }
public string uid { get; set; }
//public string u_Id { get; set; }
public List<incidentmodel> Incidents(string u_Id)
{
DTSyncdbTestRPEntities d = new DTSyncdbTestRPEntities();
var query = (from p in d.problems
join t in d.tblUsers on p.sid equals t.sid
join c in d.SU_Control on p.ControlId equals c.ControlId
join pl in d.SU_Platform on c.PlatformId equals pl.PlatformId
join s in d.status on p.status equals s.status_id
where p.uemail == u_Id
select new { p.title, s.sname, pl.PlatformName }).ToList();
List<incidentmodel> list = new List<incidentmodel>();
foreach (var x in query)
{
IncidentModel i = new IncidentModel();
i.title = x.title;
i.statusName = x.sname;
i.platFormName = x.PlatformName;
list.Add(i);


}
return (list);
}
}
Posted

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