to popluate a gridview from a database

Posted on 2008-11-18
Last Modified: 2012-08-13
we are using web application with Model View Presenter Pattern. To populate data in a grid view..getting records from database as array of string like  
public string[] GetAllUserGroups()
            return Roles.GetAllRoles();
i can see the value in the debug mode but
public string[] DataSource
            this.ASPxGridView1.DataSource = value; //i got value here
            this.ASPxGridView1.DataBind(); //here iam getting error
at databind,iam getting error like :
A field or property with the name 'RoleName' was not found on the selected data source.
pls help me......

in ascx file which contains 


<dxwgv:ASPxGridView runat="server" ID="ASPxGridView1" AutoGenerateColumns="False"

                                    EnableCallBacks="False" Width="200px" OnFocusedRowChanged="ASPxGridView1_FocusedRowChanged"> 


                                       <dxwgv:GridViewDataTextColumn Caption="Available Groups"  FieldName="RoleName"


                                            <CellStyle Wrap="False" ></CellStyle>



                                    <SettingsBehavior AllowFocusedRow="True" ProcessFocusedRowChangedOnServer="True" />



ascx.cs file:

public string[] DataSource




            this.ASPxGridView1.DataSource = value;






 string[] DataSource { set;}


presenter :

base.View.DataSource = this._controller.GetAllUserGroups();


controller contains

 public string[] GetAllUserGroups() 


            return Roles.GetAllRoles();


Open in new window

Question by:neha_john
    LVL 6

    Expert Comment

    it seems that you have a column names "RoleName" which is non existent in your datasource... better check the source.
    LVL 4

    Accepted Solution

    Yeah as carisiy says check if your select query has the column RoleName selected.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now