I am trying to save a guid to a database from a populated dropdown.

The data in the class is fine but when i save the guid back to the database for reference i get the error: "guid is not in recognized format".

When i look at the value attribtute it is empty

I am using the following to standardize my lookups

    /// <summary>
    /// Gets the days of week.
    /// </summary>
    /// <returns></returns>
    public List<StandardLookup> GetStandardLookups(Guid lookkupCode)
    {
        List<StandardLookup> lookups = new List<StandardLookup>();

        try
        {
            var q = from lookup in fhsNetEntities.fhsLookUps.Where(a => a.lookup_type == lookkupCode).OrderByDescending(o => o.colOrder)
                    orderby lookup.lookup_description
                    select new
                    {
                        LookLookupValue = lookup.lookup,
                        LookupDescription = lookup.lookup_Code.Trim(),
                        Order = lookup.colOrder
                    };

            if (q != null)
            {
                Array.ForEach(q.ToArray(), l =>
                {
                    lookups.Add(new StandardLookup(l.LookLookupValue, l.LookupDescription, l.Order));
                });
            }
        }
        catch (Exception ex)

        {
            string inner = string.Empty;
            if (ex.InnerException != null)
            {
                inner = ex.InnerException.ToString();
            }
            logger.Error("Error in GetDaysOfWeek function aperturenetdal " + ex.ToString() + " " + inner);
            return null;
        }

        return lookups;
    }



rdSaluation.DataSource = rdSaluations;
rdSaluation.DataValueField = "LookupValue";
rdSaluation.DataTextField = "LookupDescription";
rdSaluation.DataBind();

But when i got to my save event and debug I am getting the following error

enter image description here

And here you can see its grabbing the name value instead by mistake.

enter image description here

Related posts

Recent Viewed