This is a migrated thread and some comments may be shown as answers.

[Solved] Problems with Data Grid bound in Master Detail

0 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mujtaba
Top achievements
Rank 1
Mujtaba asked on 13 Oct 2011, 02:24 PM
Hi,

Below code was working find with Visual Studio 2008 and MVC 2.0

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
  
  
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
  <style type="text/css">
   /* in-form editing */  
     .t-edit-form-container    
     {        
        width: 500px;        
        margin: 1em;    
     }
      .t-edit-form-container .editor-label, 
      .t-edit-form-container .editor-field   
          {     
                 padding-bottom: 1em;     
                 float: left;    
          }
      .t-edit-form-container .editor-label    
      {   
               width: 30%;     
                  text-align: right;   
                       padding-right: 3%;      
                         clear: left;    
                         }    
       .t-edit-form-container .editor-field 
          {    
                  width: 60%;    
                  }
                    
  </style>
  
    <%= Html.Telerik().Grid((IEnumerable<PICT.Auction.Data.Auction>)ViewData["auction"])
            .Name("Grid")
            .Filterable()
            .Pageable()
            .PrefixUrlParameters(false)
            .Sortable()
            .Scrollable()
            .Editable(editing => editing.Mode(GridEditMode.PopUp))
            .DataKeys(keys => keys.Add("Unit_gkey"))
                    .DataBinding(dataBinding =>
                                dataBinding.Server().Update("EditAuction", "Unit").Enabled(true)
                        )
            .Columns(columns =>
            {
                columns.Command(c =>  {
                    c.Select();
                    c.Edit();
                }).Width("90px").Title("Commands");
                columns.Bound(o => o.Cntr).Width("150px").ReadOnly();
                columns.Bound(o => o.BlNo).Width("150px").ReadOnly();
                //columns.Bound(o => o.Category).Width("150px");
                columns.Bound(o => o.Vessel).Width("150px").ReadOnly();
                columns.Bound(o => o.Line).Width("150px").ReadOnly();
                columns.Bound(o => o.VirNo).Width("150px").ReadOnly();
                columns.Bound(o => o.Voy).Width("150px").ReadOnly();
                columns.Bound(o => o.Unit_gkey).Visible(false);
                columns.Bound(o => o.Pkey).Visible(false);
                columns.Bound(o => o.Amount_of_final_bid).Width("150px");
                columns.Bound(o => o.Assessment_proc).Width("150px");
                columns.Bound(o => o.Auct_sch_date).Width("150px");
                columns.Bound(o => o.Auct_sch_no).Width("150px");
                columns.Bound(o => o.Auct_status).Width("150px");
                columns.Bound(o => o.Bidder_name_nic).Width("150px");
                columns.Bound(o => o.Cheque_no).Width("150px");
                columns.Bound(o => o.Cheque_rec_date).Width("150px");
                columns.Bound(o => o.Cust_del_order_no).Width("150px");
                columns.Bound(o => o.Cust_duty).Width("150px");
                columns.Bound(o => o.Del_order_issued_on).Width("150px");
                columns.Bound(o => o.Grnd_for_exam).Width("150px");
                columns.Bound(o => o.Exam_done_by).Width("150px");
                columns.Bound(o => o.Exam_on).Width("150px");
                columns.Bound(o => o.Fwd_to_auct_dept).Width("150px");
                columns.Bound(o => o.Fwd_to_cust_acc_dept).Width("150px");
                columns.Bound(o => o.Fwd_to_pre_audit).Width("150px");
                columns.Bound(o => o.Remarks).Width("150px");
                columns.Bound(o => o.Sale_proc_amount).Width("150px");
                columns.Bound(o => o.Sale_proc_amount_deducted).Width("150px");
                columns.Bound(o => o.Sale_proc_amount_due).Width("150px");
                columns.Bound(o => o.Sale_proc_amount_recov).Width("150px");
                columns.Bound(o => o.Sale_proc_case).Width("150px");
                columns.Bound(o => o.Sale_proc_subt_to_cust_on).Width("150px");
                columns.Bound(o => o.Sales_tax).Width("150px");
                columns.Bound(o => o.Status).Width("150px");
            })
        %>
          
        <%=  Html.Telerik().Grid((IEnumerable<PICT.Auction.Data.Auction>)ViewData["ahistory"])
            .Name("Grid2")
            .Filterable()
            .Pageable()
            .PrefixUrlParameters(false)
            .Sortable()
            .Scrollable()
            .DataKeys(keys => keys.Add(c=>c.Pkey))
            .DataBinding(dataBinding => dataBinding
            .Server()
            .Delete("DeleteAuction", "Unit").Enabled(true)
                            )
            .RowAction(row => row.Selected = row.DataItem.Pkey.Equals(ViewData["id"]))                            
            .Columns(columns =>
            {
                columns.Command(c =>{c.Delete();}).Title("Remove").Width("90px");
                columns.Bound(o => o.Unit_gkey).Visible(false);
                columns.Bound(o => o.Pkey).Visible(false);
                columns.Bound(o => o.Cntr).Width("150px").ReadOnly();
                columns.Bound(o => o.BlNo).Width("150px").ReadOnly();
                columns.Bound(o => o.Vessel).Width("150px").ReadOnly();
                columns.Bound(o => o.Line).Width("150px").ReadOnly();
                columns.Bound(o => o.VirNo).Width("150px").ReadOnly();
                columns.Bound(o => o.Voy).Width("150px").ReadOnly();
                columns.Bound(o => o.Amount_of_final_bid).Width("150px").ReadOnly();
                columns.Bound(o => o.Assessment_proc).Width("150px").ReadOnly();
                columns.Bound(o => o.Auct_sch_date).Width("150px").ReadOnly();
                columns.Bound(o => o.Auct_sch_no).Width("150px").ReadOnly();
                columns.Bound(o => o.Auct_status).Width("150px").ReadOnly();
                columns.Bound(o => o.Bidder_name_nic).Width("150px").ReadOnly();
                columns.Bound(o => o.Cheque_no).Width("150px").ReadOnly();
                columns.Bound(o => o.Cheque_rec_date).Width("150px").ReadOnly();
                columns.Bound(o => o.Cust_del_order_no).Width("150px").ReadOnly();
                columns.Bound(o => o.Cust_duty).Width("150px").ReadOnly();
                columns.Bound(o => o.Del_order_issued_on).Width("150px").ReadOnly();
                columns.Bound(o => o.Grnd_for_exam).Width("150px").ReadOnly();
                columns.Bound(o => o.Exam_done_by).Width("150px").ReadOnly();
                columns.Bound(o => o.Exam_on).Width("150px").ReadOnly();
                columns.Bound(o => o.Fwd_to_auct_dept).Width("150px").ReadOnly();
                columns.Bound(o => o.Fwd_to_cust_acc_dept).Width("150px").ReadOnly();
                columns.Bound(o => o.Fwd_to_pre_audit).Width("150px").ReadOnly();
                columns.Bound(o => o.Remarks).Width("150px").ReadOnly();
                columns.Bound(o => o.Sale_proc_amount).Width("150px").ReadOnly();
                columns.Bound(o => o.Sale_proc_amount_deducted).Width("150px").ReadOnly();
                columns.Bound(o => o.Sale_proc_amount_due).Width("150px").ReadOnly();
                columns.Bound(o => o.Sale_proc_amount_recov).Width("150px").ReadOnly();
                columns.Bound(o => o.Sale_proc_case).Width("150px").ReadOnly();
                columns.Bound(o => o.Sale_proc_subt_to_cust_on).Width("150px").ReadOnly();
                columns.Bound(o => o.Sales_tax).Width("150px").ReadOnly();
                columns.Bound(o => o.Status).Width("150px").ReadOnly();
             })
            %>
</asp:Content>

Since I migrated my project from VS 2008 to VS 2010 ( still MVC 2.0) Server Bindings are not invoking proper action methods.

here is my controller:
public ActionResult GetAuction(string id)
    {
        ViewData["auction"] = CollectionHelper.GetAuctionUnits(ServiceManager.GetAuctionService().GetAllAuctionUnits().AUCTION_DESTRUCTION);
        if (!string.IsNullOrEmpty(id))
            ViewData["ahistory"] = CollectionHelper.GetAuctionHistory(ServiceManager.GetAuctionService().GetAuctionUnitHistory(id).AUCTION_DESTRUCTION_HISTORY);
        return View();
    }
  
 [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult EditAuction(
    Int32 Unit_gkey,
    decimal? Amount_of_final_bid,
    string Assessment_proc,
    DateTime? Auct_sch_date,
    string Auct_sch_no,
    string Auct_status,
    string Bidder_name_nic,
    string Cheque_no,
    DateTime? Cheque_rec_date,
    string Cust_del_order_no,
    decimal? Cust_duty,
    DateTime? Del_order_issued_on,
    DateTime? Grnd_for_exam,
    string Exam_done_by,
    DateTime? Exam_on,
    string Fwd_to_auct_dept,
    string Fwd_to_cust_acc_dept,
    string Fwd_to_pre_audit,
    string Remarks,
    decimal? Sale_proc_amount,
    decimal? Sale_proc_amount_deducted,
    decimal? Sale_proc_amount_due,
    string Sale_proc_amount_recov,
    string Sale_proc_case,
    DateTime? Sale_proc_subt_to_cust_on,
    decimal? Sales_tax,
    string Status
    )
    {
        try
        {
            AuctDest input = new AuctDest();
            input.Sale_proc_case = Sale_proc_case;
            input.Sale_proc_subt_to_cust_on = Sale_proc_subt_to_cust_on;
            input.Fwd_to_cust_acc_dept = Fwd_to_cust_acc_dept;
            input.Fwd_to_pre_audit = Fwd_to_pre_audit;
            input.IsAuction = 1;
            input.Unit_gkey = Unit_gkey;
            input.Assessment_proc = Assessment_proc;
            input.Fwd_to_auct_dept = Fwd_to_auct_dept;
            input.Auct_sch_no = Auct_sch_no;
            input.Auct_sch_date = Auct_sch_date;
            input.Auct_status = Auct_status;
            input.Cust_del_order_no = Cust_del_order_no;
            input.Del_order_issued_on = Del_order_issued_on;
            input.Bidder_name_nic = Bidder_name_nic;
            if (Grnd_for_exam.HasValue)
                input.Grnd_for_exam = Grnd_for_exam;
            if (!string.IsNullOrEmpty(Exam_done_by))
                input.Exam_done_by = Exam_done_by;
            if (Exam_on.HasValue)
                input.Exam_on = Exam_on;
            if (Amount_of_final_bid != null)
                input.Amount_of_final_bid = double.Parse(Amount_of_final_bid.ToString());
            if (Cust_duty != null)
                input.Cust_duty = double.Parse(Cust_duty.ToString());
            if (Sales_tax != null)
                input.Sales_tax = double.Parse(Sales_tax.ToString());
            if (Sale_proc_amount_due != null)
                input.Sale_proc_amount_due = double.Parse(Sale_proc_amount_due.ToString());
            if (Sale_proc_amount_deducted != null)
                input.Sale_proc_amount_deducted = double.Parse(Sale_proc_amount_deducted.ToString());
            input.Sale_proc_amount_recov = Sale_proc_amount_recov;
            if (Sale_proc_amount != null)
                input.Sale_proc_amount = double.Parse(Sale_proc_amount.ToString());
            input.Cheque_no = Cheque_no;
            input.Cheque_rec_date = Cheque_rec_date;
            input.Remarks = Remarks;
            int test = DbHelper.EditUnit(CollectionHelper.GetUnit(list, Unit_gkey.ToString()), input);
          return RedirectToAction("GetAuction");
        }
        catch (Exception ex)
        {
            string txt = ex.Message;
            return RedirectToAction("GetAuction");
        }
    }
  
[AcceptVerbs(HttpVerbs.Post)]
    public ActionResult DeleteAuction(int id)
    {
        int temp=ServiceManager.GetAuctionService().DelByPkey(id.ToString());
        return RedirectToAction("GetAuction");
    }

Instead of EditAuction and DeleteAuction it's going to GetAuction method all the time. Please help me with this issue.
Tags
Grid
Asked by
Mujtaba
Top achievements
Rank 1
Share this question
or