Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • rana 6 posts 75 karma points
    Aug 04, 2015 @ 03:23
    rana
    0

    Search data through database using postback

    public class BlogPostSurfaceController : Umbraco.Web.Mvc.SurfaceController {

        List<Listing> _listingsP = new List<Listing>();
        int _pageSize = 10;
    
      [ChildActionOnly]
      public ActionResult ShowCommentForm(int memberId)
      {
         // var member = Membership.GetUser(memberId);
          var model = new Result();
          //if (member != null)
          //{
          //    model.Name = member.UserName;
          //    model.Email = member.Email;
          //}
          return PartialView("BlogCommentForm", model);
      }
    
    
    
                     [HttpPost]
      public ActionResult CreateComment(string address, string keywords, IEnumerable<string> cbservices, IEnumerable<string> cbcertificates, IEnumerable<string> cblanguages, string cbtime, string ratingtarget, string yearsinbusinees, string PageClicked, string SortBy, string RecordPerPage)
                    {    
                    //model not valid, do not save, but return current Umbraco page
                        if (!ModelState.IsValid)
                        {
                            //Perhaps you might want to add a custom message to the ViewBag
                            //which will be available on the View when it renders (since we're not 
                            //redirecting)          
                            return CurrentUmbracoPage();
                        }
    
    
    
    
    
                         Result res=new  Result()
                                    {
                                        Listings = GenerateData(_listingsP),
                                        TotalCount = totalCount,
                                        TotalPages = totalPages
                                    };
    
    
    
    
    
    
    
    
                         TempData["ccgs"] = res;
    
    
    
                     return CurrentUmbracoPage();
    
                     }
    

    and my view is

    @using MySite.Controllers @model Result

    @using DoTaxServices @using System.Globalization @{ ServicesRepository SR = new ServicesRepository();

    MembershipController MC = new MembershipController();
    int CurrentMemberId = MC.GetCurrentMemberId();
    
    var stateName = "";
    if (!string.IsNullOrEmpty(Request["address"]))
    {
        TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
        stateName = textInfo.ToTitleCase(Request["address"].Replace("-", " "));
    }
    

    }

    Find an Accountant

    @using (Html.BeginUmbracoForm

        i could not able to search data through database using postback surfacecontroller....
    

    please suggest solution?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies