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 6689119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:28:55+00:00 2026-05-26T05:28:55+00:00

my webside has a gridview i bind it to a dataset recived from powershell

  • 0

my webside has a gridview
i bind it to a dataset recived from powershell

in this dataset are a lot of different data types.

everything is working fine but for one field i would like to bind a deeper property to the boundfield!

i bind it like this:

c#

GridViewAgentGroups.DataSource = dt;
GridViewAgentGroups.DataBind();

Markup

        <asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" />
        <asp:BoundField HeaderText="Service" ReadOnly="True"
                        DataField="Identity" />
        <asp:BoundField DataField="Description" HeaderText="Description" 
                        ReadOnly="True" />

the boundfield of service binds to data of type: "Microsoft.Rtc.Rgs.Management.RgsIdentity"

it contains an instanceID and serviceID propertyand the serviceID contains a property fullName!

when i bind it directly like "DataField="Identity" it shows a very long string with the fullName included!

is there a way to only bind the fullName? like "DataField="Identity.ServiceID.FullName"? in xml? (this does not work 🙂

  • 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-05-26T05:28:56+00:00Added an answer on May 26, 2026 at 5:28 am

    Yes it is possible with TemplateFields but it depends upon the dataSource design too. Have a look at this sample:

    Markup:

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <%#Eval("Name") %>
                    <%#Eval("GroupName.Name") %>
                    <%#Eval("GroupName.RegionName.Name") %>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    

    Code behind:

    public class Region
    {
        public string Name { get; set; }
    }
    public class Group
    {
        public string Name { get; set; }
        private Region _region=new Region();
        public Region RegionName { get { return _region; } set { _region = value; } }
    }
    public class Product
    {
        public string Name { get; set; }
        private Group _groupName = new Group();
        public Group  GroupName { get { return _groupName; } set { _groupName = value; } }
    }
    public class Products : List<Product>
    {
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Region reg1 = new Region() { Name = "North" };
            Region reg2 = new Region() { Name = "East" };
            Group group1 = new Group() { Name="Group1", RegionName=reg1  };
            Group group2 = new Group() { Name = "Group2", RegionName=reg1 };
            Group group3 = new Group() { Name = "Group3", RegionName = reg2 };
            Products prod = new Products()
            {
                    new Product(){ Name="Product1", GroupName=group1},
                    new Product(){ Name="Product1", GroupName=group2},
                    new Product(){ Name="Product2", GroupName=group3},
                    new Product(){ Name="Product3", GroupName=group1},
                    new Product(){ Name="Product2", GroupName=group2},
            };
    
            GridView1.DataSource = prod;
            GridView1.DataBind();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my website, I have a gridview which has datasource dynamically bound from database
I converted a forms website into an application and everything has been working just
I am developing a component for Joomla website. This website has a sophisticated template
Well, I guess this day had to come. My client's website has been compromised
My website has a javascript variable (addselectedsubdivision) that loads a neighborhood name from a
I have a table in a my Dynamic Data website that has a Primary
I have created a table in ASP MVC and populate it with data from
I am working on a co-workers website, and he mistakenly put up a gridview
A client has just asked me to fix an issue with their webside. I
My website has no user registration (members are pulled through from an offline db)

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.