Search Results

Search found 2 results on 1 pages for 'amina'.

Page 1/1 | 1 

  • Hiding dropdown list when list is empty

    - by Amina
    I currently have a dropdown list that is populated on page load and sometimes the dropdown list doesn't contain anything and is empty. I would like the hide the dropdown list whenever there aren't any items in the list. I thought i could do this via javascript but i am not sure what i could be doing wrong because after adding the javascript it stills appear on the page. dropdown select: <select data-bind="options: endReason() ? endReason().SubReasons : [], value: subReasonId, optionsText: 'Text', optionsValue: 'Value', visible: isChecked" name="subReasons"> </select> This is my Javascript: <script type="text/javascript"> function OnClientDropDownOpening(sender, eventArgs) { var combo = $find("<%= subReasons %>"); items = combo.get_items(); if(items.get_count()==0) { eventArgs.set_cancel(true); } } </script>

    Read the article

  • setting value to a parameter - always saying that it is null REALLY NEED INPUT

    - by Amina
    So I have this schedule visit page with two groups. Group 1 contains a list of: Cases. Group 2 contains a list of: Parties. each group has a checkboxes next to its item for the user to select. My Issue when i select a case and/or a party and save -- then go to the edit page of the visit i just saved and only my selected case is checked and the party i selected is not checked. After debugging i realized that the partyId is not being saved properly during the create page and thus not showing as selected or saved on the edit page. I really need help on how to properly save the party selected and setting for it a value from the parameter. Here is my code of what i have for saving a case and would like to know how to properly save with party. Controller [HttpPost] [ValidateInput(false)] public ActionResult Create(VisitViewModel viewModel, Guid[] associatedCasesSelected, Guid[] selectedParties) { if (!ModelState.IsValid) { viewModel.Time = _timeEntryHelper.Value; AddLookupsToViewModel(viewModel); return View(viewModel); } var visitEntry = Mapper.Map<VisitViewModel, VisitEntry>(viewModel); ... viewModel.CasePartyIds = selectedParties; try { _visitEntryService.Create(visitEntry, associatedCasesSelected); this.FlashInfo(string.Format(Message.ConfirmationMessageCreate, Resources.Entities.Visit.EntityName)); } catch (RulesException ex) { ex.CopyTo(ModelState); } if (ModelState.IsValid) return RedirectToAction("Edit", "Case", new { caseId = viewModel.CaseId }); AddLookupsToViewModel(viewModel); return View(viewModel); } VisitEntryService public void Create(VisitEntry visitEntry,IList<Guid>caseIds) { EnsureValid(visitEntry); _visitEntryRepository.Save(visitEntry); caseIds = AddCurrentCaseToCases(visitEntry.CaseId, caseIds); foreach (var caseId in caseIds.Distinct()) { var visit = new Visit {CaseId = caseId, VisitEntryId = visitEntry.VisitEntryId}; _visitService.Create(visit); } } AddCurrentCaseToCases private static IList<Guid>AddCurrentCaseToCases(Guid caseId, IEnumerable<Guid>caseIds) { var cases = new List<Guid>(); if (caseIds != null) { cases.AddRange(caseIds); if(!caseIds.Contains(caseId)) cases.Add(caseId); } else cases.Add(caseId); return cases; } VisitService public Visit Get(Guid visitId) { return DataContext.Visits.SingleOrDefault(v => v.VisitId == visitId); } public void Save(Visit visit) { if(visit.VisitId == Guid.Empty) { visit.VisitId = Guid.NewGuid(); DataContext.Visits.InsertOnSubmit(visit); } else { var currentVisit = Get(visit.VisitId); if (currentVisit == null) throw RepositoryExceptionFactory.Create("Visit", "VisitId"); } DataContext.SubmitChanges(); } Any TIPS or IDEAS is greatly appreciated at this time :) The entitiy for the parties will be VisitEntryParty

    Read the article

1