locked
Can't edit a RIA service column RRS feed

  • Question

  • I've created a RIA service. I display it in a Data Grid. I only have one column that I want to be editable (Text Box). There are other columns but all are labels. When I click on the field it turns white then immediately turns gray and can't be edited. I've looked online but can't find the solution. I have the [Key] attribute. The Update routine is spelled correctly. I have views elsewhere the have a check box "Is Editable" but there isn't a checkbox for my RIA service entity. I'm stuck!

    DebitFeeMethodValue is the field that should be editable.

    Here is the code:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.ServiceModel.DomainServices.Server;
    using System.Data.EntityClient;
    using System.Web.Configuration;
    using System.Configuration;
    using LightSwitchApplication.Implementation;

    namespace FeeRia
    {
    public class EditableConceptDepartmentFeeCreditDebit
    {
    [Key]
    public int DebitDetailId { get; set; }
    public int CreditDetailId { get; set; }
    public int ConceptId { get; set; }
    public string Concept { get; set; }
    public int DepartmentId { get; set; }
    public int Department { get; set; }
    public int ?TaxStateId { get; set; }
    public string TaxStateName { get; set; }
    public string FeeName { get; set; }
    public int FeeMethodId { get; set; }
    public string FeeMethodName { get; set; }
    public int DebitFeeId { get; set; }
    public double DebitFeeMethodValue { get; set; }
    public int? DebitGLAccountId { get; set; }
    public string DebitGLAccount { get; set; }
    public string DebitGLDepartment { get; set; }
    public bool DebitIsDebit { get; set; }
    public int CreditFeeId { get; set; }
    public double CreditFeeMethodValue { get; set; }
    public int? CreditGLAccountId { get; set; }
    public string CreditGLAccount { get; set; }
    public string CreditGLDepartment { get; set; }
    public bool CreditIsDebit { get; set; }
    }

    public class FeeRiaService : DomainService
    {
    // This Context property is code that connects to the LightSwitch database
    #region Database connection
    private SPDCData m_context;
    public SPDCData Context
    {
    get
    {
    if (this.m_context == null)
    {
    //....
    }
    return this.m_context;
    }
    }
    #endregion
    [Query(IsDefault = true)]
    public IQueryable<EditableConceptDepartmentFeeCreditDebit> GetAllEditableConceptDepartmentFeeCreditDebits()
    {
    // Get all the Order Details
    IQueryable<EditableConceptDepartmentFeeCreditDebit> colEditableFee = from Fees in this.Context.ConceptDepartmentFeeDebitCredits
    select new EditableConceptDepartmentFeeCreditDebit
      {
    DebitDetailId = Fees.DebitDetailId,
    CreditDetailId = Fees.CreditDetailId,
    ConceptId = Fees.ConceptId,
    Concept = Fees.Concept,
    DepartmentId = Fees.DepartmentId,
    Department = Fees.Department,
    TaxStateId = Fees.TaxStateId,
    TaxStateName = Fees.TaxStateName,
    FeeName = Fees.FeeName,
    FeeMethodId = Fees.FeeMethodId,
    FeeMethodName = Fees.FeeMethodName,
    DebitFeeId = Fees.DebitFeeId,
    DebitFeeMethodValue = Fees.DebitFeeMethodValue,
    DebitGLAccountId = Fees.DebitGLAccountId,
    DebitGLAccount = Fees.DebitGLAccount,
    DebitGLDepartment = Fees.DebitGLDepartment,
    DebitIsDebit = Fees.DebitIsDebit,
    CreditFeeId = Fees.CreditFeeId,
    CreditFeeMethodValue = Fees.CreditFeeMethodValue,
    CreditGLAccountId = Fees.CreditGLAccountId,
    CreditGLAccount = Fees.CreditGLAccount,
    CreditGLDepartment = Fees.CreditGLDepartment,
    CreditIsDebit = Fees.CreditIsDebit
      };
    return colEditableFee;
    }
    // Override the Count method in order for paging to work correctly
    protected override int Count<T>(IQueryable<T> query)
    {
    // Get all the Order Details
    return this.Context.ConceptDepartmentFeeDebitCredits.Count();
    }

    public void UpdateEditableConceptDepartmentFeeCreditDebit(EditableConceptDepartmentFeeCreditDebit objEditableConceptDepartmentFeeCreditDebit)
    {
    }
    }
    }

    Scott Mitchell


    Monday, March 2, 2015 8:28 PM

Answers

All replies