@QWRtaW5oMzIyZQ
Admin at Help2Engg
Admin
Like · Comment ·
Admin
publicint? ID { get; set; }

[Required]
publicstring name { get; set; }
[Required]
publicint salary { get; set; }

[Required(ErrorMessage = "State is Required."]
publicintstateId { get; set; }

publicList<SelectListItem>getState { get; set; }

publicList<ListEmp_Result>ListEmployee { get; set; }
publicActionResult About()
{
ViewBag.Message = "Your application description page.";
objEmp.getState = BindState();
ViewData["GetStateList"] = newSelectList(objEmp.getState, "Value", "Text", 0);
return View();
}
publicJsonResultListEmployee()
{
try
{
objEmp.ListEmployee = obj.ListEmp().ToList();
returnJson(objEmp, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
throw ex;
}
}
publicList<SelectListItem>BindState()
{

List<SelectListItem>lststate = newList<SelectListItem>();
var cat = obj.ListState().ToArray();
if(cat.Length>=1 || cat.Length==0)
{
lststate.Add(newSelectListItem { Text="--SELECT",Value=""});
}
for (int i = 0; i <cat.Length; i++)
{
lststate.Add(newSelectListItem
{
Text = cat[i].StateName.ToString(),
Value = cat[i].StateID.ToString()
});
}
returnlststate;
}
publicActionResult About(Employeeemp)
{
if (ModelState.IsValid)
{
if(emp.ID>0)
{
obj.SaveEmp(emp.ID, emp.name.ToString(), emp.salary, emp.stateId);
}
else
{
obj.SaveEmp(0, emp.name.ToString(), emp.salary, emp.stateId);
}
returnRedirectToAction("About";
}
objEmp.getState = BindState();
ViewData["GetStateList"] = newSelectList(objEmp.getState, "Value", "Text",0);
return View(emp);
}
Like · Comment ·
Ansari Tahir likes this
Admin
@using (Html.BeginForm("About", "Home", FormMethod.Post))
{
<div>
@Html.HiddenFor(m => m.ID, new {id="hdnID"})
<div>Name :</div><div>@Html.TextBoxFor(m => m.name, new { id="txtname"})</div>
@Html.ValidationMessageFor(m => m.name, "", new { @class = "text-danger" })
<div>salary :</div><div>@Html.TextBoxFor(m =>m.salary, new { id = "txtsalary" })</div>
@Html.ValidationMessageFor(m =>m.salary, "", new { @class = "text-danger" })
<div>state :</div>
<div>
@Html.DropDownListFor(m =>m.stateId, (IEnumerable<SelectListItem>ViewData["GetStateList"], null, new { id = "ddlstate", name = "ddlstate", @class = "form-control" })
</div>
@Html.ValidationMessageFor(m =>m.stateId, "", new { @class = "text-danger" })
<divclass="form-group">
<divclass="col-md-offset-2 col-md-10">
<inputtype="submit"value="Create"class="btnbtn-danger"/>
</div>
</div>
</div>
}
Like · Comment ·

Ansari Tahir

can i upload project ..
Like ·
Admin
<scripttype="text/javascript">
$(document).ready(function () {
$.getJSON("/Home/ListEmployee", function (json) {
for (var i = 0; i <json.ListEmployee.length; i++) {
vartr = $('<tr/>';
tr.append("<td>" + json.ListEmployee[i].name + "</td>";
tr.append("<td>" + json.ListEmployee[i].salary + "</td>";
tr.append("<td><a style='cursor:pointer'; onClick=EditData('" + json.ListEmployee[i].ID + "','" + json.ListEmployee[i].name + "','" + json.ListEmployee[i].salary + "','" + json.ListEmployee[i].State + "'>Edit</a></td>";
tr.append("<td><a onClick=Delete(" + json.ListEmployee[i].ID + ">Delete<a/></td>";
$('table'.append(tr);
}
$('#example'.dataTable();
});
});
functionEditData(ID, name, salary, state)
{
$('#hdnID'.val(ID);
$('#txtname'.val(name);
$('#txtsalary'.val(salary);
$('#ddlstate'.val(state).attr("selected", "selected";
}
function Delete(ID)
{
$.ajax({
url: "/Home/Delete",
data: { ID: ID },
success: function (data) {
window.location.reload();
alert("delete successfull";
},
error: function () {
alert("Error Found in Delete";
}
})
}
</script>
Like · Comment ·
Admin
We waiting for your feedback. http://www.help2engg.com/feedback
Like · Comment ·
Admin
Happy New Year

Like · Comment ·
Admin
Happy Independence Day

Like · Comment ·
Admin
Like · Comment ·
Admin
Like · Comment ·
Khilna Patel likes this
Admin
GATE Study material : http://www.help2engg.com/GATE/GATE-study-material ‪#‎GATE‬ ‪#‎gatestudymaterial‬ ‪#‎gatematerial‬
Like · Comment ·
Admin
GTU paper solution : Web Technology and Programming - Dec 2014 : http://www.help2engg.com/gtu-paper-solution/161602-web-technology-and-programming-Dec-2014
Like · Comment ·
sardhara mayur likes this
Admin
Opening for Java Developers and Tech Lead
1) Java Developer
Location : Ahmedabad Experience : 1-6 Years
Skills : Core Java, Design Patterns
2) Java Tech Lead
Location : Ahmedabad Experience : 1-6 Years
Skills : Core Java, Design Patterns, Java Profiling, J2EE, Struts, Hibernate, JQuery, Leadership Experience
3) UI Developer
Location : Ahmedabad Experience : 1-6 Years
Skills : Core Java, Jquery, Struts, HTML, CSS, Java Script, Core JAVA Scripts with OOPS, Responsive Design
Send your resume to : devang.adeshara@elitecore.com
Like · Comment ·
Admin
One point communication system : https://www.facebook.com/thetimerim
Like · Comment ·
Admin
Like · Comment ·
Admin
Like · Comment ·
Admin
Job requirement for freshers only :
Language : PHP, Android
Qualification : BE./DE IT/CE, BCA, MCA, M. Sc. IT
Location : Ahmedabad
Send your resume at career@ayursattvatechnovation.com or call on +917878314409
Like · Comment ·
Hardik Mistry likes this
Admin
Like us on Facebook : https://www.facebook.com/help2engg
Like · Comment ·
Admin
Like · Comment ·
Admin
Job requirement for freshers :
Language : PHP
Location : Ahmedabad
Send your resume at career@help2engg.com or call on +917878314409
Like · Comment ·
Admin
e learning materials for gtu : http://www.e-learning.help2engg.com/
Like · Comment ·
Admin
Now follow your company and stay connected with it : http://www.help2engg.com/career-path/company
Like · Comment ·
Admin
We are launching eBook section : Visit here : http://www.help2engg.com/ebook/
Like · Comment ·
Mayur Joshi likes this
Admin
We have launched a new website : e-Learning Portal : http://www.e-learning.help2engg.com/ ‪#‎eLearn‬ ‪#‎help2engg‬
Comment with your ideas and suggestions
Like · Comment ·
Ansari Md Tahir likes this
Admin
Follow us on facebook : http://www.facebook.com/help2engg
Like · Comment ·
Admin
is now following MSU, Faculty Of Technology and Engineering
Total rating : 5.00 from 1 user(s)
Total Review : 0
Like · Comment ·
Arpan Patel likes this
Admin
Proud to be an indian! Happy Republic Day!

Like · Comment ·
Joydip Panchal likes this
Download Android App