?
Solved

to popluate a gridview from a database

Posted on 2008-11-18
2
Medium Priority
?
615 Views
Last Modified: 2012-08-13
we are using c#.net 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
    {
        set
        {
            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"> 
                                    <Columns>
                                       <dxwgv:GridViewDataTextColumn Caption="Available Groups"  FieldName="RoleName"
                                            VisibleIndex="0">
                                            <CellStyle Wrap="False" ></CellStyle>
                                        </dxwgv:GridViewDataTextColumn>
                                   </Columns>
                                    <SettingsBehavior AllowFocusedRow="True" ProcessFocusedRowChangedOnServer="True" />
                                                                     </dxwgv:ASPxGridView>
*************
ascx.cs file:
public string[] DataSource
    {
        set
        {
            this.ASPxGridView1.DataSource = value;
            this.ASPxGridView1.DataBind();
        }
    }
***************************
interface:
 string[] DataSource { set;}
****************
presenter :
base.View.DataSource = this._controller.GetAllUserGroups();
************************
controller contains
 public string[] GetAllUserGroups() 
        {
            return Roles.GetAllRoles();
        }

Open in new window

0
Comment
Question by:neha_john
2 Comments
 
LVL 6

Expert Comment

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

Accepted Solution

by:
lotusnotesnewbie earned 1000 total points
ID: 22991912
Yeah as carisiy says check if your select query has the column RoleName selected.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

809 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