tag:blogger.com,1999:blog-135679937759933551.post7462021772981933847..comments2024-03-11T15:37:07.877+05:30Comments on Subhash DotNet World: TCS Dot net interview questionsSubhash.Nhttp://www.blogger.com/profile/18379894468192655565noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-135679937759933551.post-60331044157960445862021-09-27T21:53:29.207+05:302021-09-27T21:53:29.207+05:30Helpful postHelpful postVision Developmenthttps://www.blogger.com/profile/01916313869940250155noreply@blogger.comtag:blogger.com,1999:blog-135679937759933551.post-16775926369545877932021-09-07T20:53:54.525+05:302021-09-07T20:53:54.525+05:30Thanks! It was helpfulThanks! It was helpfulSamvedna Yadavhttps://www.blogger.com/profile/07223438317064937304noreply@blogger.comtag:blogger.com,1999:blog-135679937759933551.post-19637279419450054022017-02-14T15:03:06.792+05:302017-02-14T15:03:06.792+05:30This is a great post. I like this topic.This site ...This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.<br /><br /><a href="http://backtooriginal.com" rel="nofollow">Back to Original Services Private Limited</a> jeslinhttps://www.blogger.com/profile/13560935498632494937noreply@blogger.comtag:blogger.com,1999:blog-135679937759933551.post-24989104744720669002017-02-09T15:32:45.335+05:302017-02-09T15:32:45.335+05:30Ans for 19th Quesiton
$(".txtboxtocheck&qu...Ans for 19th Quesiton<br /><br /><br /><br />$(".txtboxtocheck").change(function(){<br /> var enablebtn = true;<br /> $(".txtboxtocheck").each(function(){<br /> if($(this).val() == '')<br /> enablebtn = false;<br /> });<br /><br /> if(enablebtn)<br /> $("#butn").attr('disabled',false);<br /> else<br /> $("#butn").attr('disabled',true);<br />});<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-135679937759933551.post-81770523876641912932017-02-09T15:22:43.787+05:302017-02-09T15:22:43.787+05:30Ans for 11th Question
I would say this is good ex...Ans for 11th Question<br /><br />I would say this is good example of using ViewModel here. I would suggest something like -<br /><br />Create ViewModel with the composition of the two classes<br /><br />public class AddWeightModel<br />{<br /> [Required]<br /> [DataType(DataType.Text)]<br /> [Display(Name = "Stone")]<br /> public Nullable Stone { get; set; }<br /><br /> [Required]<br /> [DataType(DataType.Text)]<br /> [Display(Name = "Pound")]<br /> public Nullable Pound { get; set; }<br />}<br />....<br />public partial class Weight<br />{<br /> public int Id { get; set; }<br /> public string UserId { get; set; }<br /> public Nullable Stone { get; set; }<br /> public Nullable Pound { get; set; }<br /> public Nullable Date { get; set; }<br />}<br />.....<br />public class WeightViewModel<br />{<br /> public IList AddWeightModel { get; set; }<br /> public Weight Weight { get; set; }<br />}<br /><br />Then change your view to accept the view models -<br /><br />@model WeightViewModel<br /><br />Finally modify your controller to cope with the change -<br /><br />public ActionResult RecordCard()<br /> {<br /> var UserId = User.Identity.GetUserId();<br /> var weightModel = from m in db.Weights where m.UserId == UserId select m;<br /> var viewModel = new WeightViewModel<br /> {<br /> Weight = weightModel,<br /> AddWeightModel = new List(){}<br /> };<br /> return View(viewModel);<br /> }<br /><br />[HttpPost]<br />[ValidateAntiForgeryToken]<br />public ActionResult RecordCard(WeightViewModel viewModel)<br />{<br /> Weight Model = viewModel.Weight;<br /> if (ModelState.IsValid)<br /> {<br /> using (WebApplication1Entities db = new WebApplication1Entities())<br /> {<br /> Weight weight = new Weight();<br /> weight.UserId = User.Identity.GetUserId();<br /> weight.Stone = Model.Stone;<br /> weight.Pound = Model.Pound;<br /> weight.Date = System.DateTime.Now;<br /><br /> db.Weights.Add(Model);<br /> db.SaveChanges();<br /> }<br /> }<br /> return RedirectToAction("RecordCard");<br />}<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-135679937759933551.post-23787200300587593512017-02-09T15:19:16.826+05:302017-02-09T15:19:16.826+05:30 Ans For 6
If Tempdata is assigned in the current... Ans For 6<br /><br />If Tempdata is assigned in the current request then it will be available for the current request and the subsequent request and it depends whether data in TempData read or not. If data in Tempdata is read then it would not be available for the subsequent requestsAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-135679937759933551.post-14286226151304116862017-02-09T15:01:33.808+05:302017-02-09T15:01:33.808+05:30send the result back in JSON format in MVC
Ans:
p...send the result back in JSON format in MVC<br /><br />Ans:<br />public JsonResult getCustomer() {<br /> Customer obj = new Customer();<br /> obj.CustomerCode = "1001";<br /> obj.CustomerName = "Shiv";<br /> return Json(obj, JsonRequestBehavior.AllowGet);<br />}Anonymousnoreply@blogger.com