Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8790395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:38:22+00:00 2026-06-13T22:38:22+00:00

I have a config data from a DHCP server that I put into classes

  • 0

I have a config data from a DHCP server that I put into classes like this:

public class DHCP
{
    public DHCP()
    {
        this.Scopes = new List<Scope>();
    }

    public List<Scope> Scopes;

    public class Scope
    {
        public Scope(string ScopeAddress, string SubnetMask, string State, string ScopeName, string Comment)
        {
            this.ScopeAddress = ScopeAddress;
            this.SubnetMask = SubnetMask;
            this.State = State;
            this.ScopeName = ScopeName;
            this.Comment = Comment;
        }

        public Scope(string ScopeAddress, string SubnetMask, string State, string ScopeName, string Comment, bool initClients)
        {
            this.ScopeAddress = ScopeAddress;
            this.SubnetMask = SubnetMask;
            this.State = State;
            this.ScopeName = ScopeName;
            this.Comment = Comment;

            if (initClients)
                this.Clients = new List<Client>();
        }

        public void InitClients()
        {
            this.Clients = new List<Client>();
        }

        public void InitReservations()
        {
            this.Reservations = new List<Reservation>();
        }

        public string ScopeAddress { get; set; }
        public string SubnetMask { get; set; }
        public string State { get; set; }
        public string ScopeName { get; set; }
        public string Comment { get; set; }

        public List<Client> Clients;
        public List<Reservation> Reservations;
    }

    public class Client
    {
        public Client(string IPAddress, string SubnetMask, string UniqueID, string LeaseExpires, string ClientType)
        {
            this.IPAddress = IPAddress;
            this.SubnetMask = SubnetMask;
            this.UniqueID = UniqueID;
            this.LeaseExpires = LeaseExpires;
            this.ClientType = ClientType;
        }

        public string IPAddress { get; set; }
        public string SubnetMask { get; set; }
        public string UniqueID { get; set; }
        public string LeaseExpires { get; set; }
        public string ClientType { get; set; }
        public Reservation ClientReservation { get; set; }
    }

    public class Reservation
    {
        public Reservation(string IPAddress, string UniqueID, bool ReservationActive)
        {
            this.IPAddress = IPAddress;
            this.UniqueID = UniqueID;
            this.ReservationActive = ReservationActive;
        }

        public string IPAddress { get; set; }
        public string UniqueID { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public string Type { get; set; }
        public bool ReservationActive { get; set; }
    }
}

Then I have a List<DHCP.Client> that I use for DataSource on the gridview. When I set one of the data fields to ClientReservation.ReservationActive I get a not found error.

I have tried this with a List<> where this is no NULL data at all.
So I have to questions:

Can this be done at all?
If I have an object where Client.ClientReservation == null how can I handle that on DataBind() without an error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:38:23+00:00Added an answer on June 13, 2026 at 10:38 pm

    I found a solution for both issues. By using a template field like this:

    <asp:TemplateField>
      <ItemTemplate>
        <%#DataBinder.Eval(Container.DataItem, "ClientReservation.ReservationActive")%>
      </ItemTemplate>
     </asp:TemplateField>
    

    It get’s the value of the nested class (sub property) and ignores it without error if ClientReservation is NULL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three SQL Server databases that a single application retrieves data from. I
We have a set of tables and views that merely store some config data
I have some configuration data in a config file that I read off disk
I have an ADO.NET Managed Data Provider that is registered in machine.config in DbProviderFactory
I have something like this: <?xml version=1.0 encoding=utf-8?> <Data> <ConfigDatas> <ArrayOfConfigData xmlns:i=http://www.w3.org/2001/XMLSchema-instance xmlns=http://schemas.datacontract.org/2004/07/BTTest.Models> <ConfigData>
i have created a java application which uses data from its config folder and
Have problem while getting data from Memcached on .NET MVC solution. I have this
Scenario: I have an application that pulls data from a SQL database as well
We have manage to export data from our mysql table into a .txt file.
I have my model as this: Ext.define(NotesApp.model.Note, { extend: Ext.data.Model, config: { idProperty: 'id',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.