没有数据显示 GridView Asp Net DevExpress

No data to display GridView Asp Net DevExpress

我尝试在 devexpress 中制作 gridview 及其工作,但如果我单击下一页,页面会收到消息没有数据可显示。 我尝试从 asp 网络制作,但同样的问题没有数据显示。 如何解决?对不起,我是新手。

这是我的 aspx 代码:

<dx:BootstrapGridView runat="server" ID="GVcity" AutoGenerateColumns="False" >
                <SettingsEditing Mode="Inline"></SettingsEditing>
                <SettingsDataSecurity AllowEdit="true" AllowDelete="true" AllowInsert="true"  />
                <SettingsBehavior AllowSelectSingleRowOnly="true" AllowSelectByRowClick="true" /> 
                <Columns>
                    <dx:BootstrapGridViewTextColumn FieldName="localRegionName" VisibleIndex="0" Caption="Regional"></dx:BootstrapGridViewTextColumn>
                    <dx:BootstrapGridViewTextColumn FieldName="localRegionCode" VisibleIndex="1" Caption="Code"></dx:BootstrapGridViewTextColumn>
                    <dx:BootstrapGridViewTextColumn FieldName="CityName" VisibleIndex="2" Caption="City"></dx:BootstrapGridViewTextColumn>
                </Columns>
                    <Settings ShowFilterRow="true" ShowFilterRowMenu="true"  />

               
            </dx:BootstrapGridView>

这是我的 CS 代码:

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        
            this.BindGrid();
        
    }

    private void BindGrid()
    {
        string constr = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
        using (MySqlConnection con = new MySqlConnection(constr))
        {
            using (MySqlCommand cmd = new MySqlCommand("SELECT tblcity.localRegionCode, tblcity.CityName, tbllocalregion.localRegionName FROM tblcity, tbllocalregion where tblcity.localRegionCode = tbllocalregion.localRegionCode"))
            {
                using (MySqlDataAdapter sda = new MySqlDataAdapter())
                {
                    cmd.Connection = con;
                    sda.SelectCommand = cmd;
                    using (DataTable dt = new DataTable())
                    {
                        sda.Fill(dt);
                        GVcity.DataSource = dt;
                        GVcity.DataBind();
                    }
                }
            }
        }
    }

    protected void OnPageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GVcity.PageIndex = e.NewPageIndex;
        this.BindGrid();
    }

我尝试显示来自 mysql 的数据,但我不知道我错过了什么???


<dx:BootstrapGridView runat="server" ID="GVcity" AutoGenerateColumns="False" AllowPaging="True" OnPageIndexChanging="OnPageIndexChanging" OnPageIndexChanged="GVcity_PageIndexChanged">
                <Columns>
                    <dx:BootstrapGridViewTextColumn FieldName="localRegionName" VisibleIndex="0" Caption="Regional"></dx:BootstrapGridViewTextColumn>
                     
                    <dx:BootstrapGridViewTextColumn FieldName="localRegionCode" VisibleIndex="1" Caption="Code"></dx:BootstrapGridViewTextColumn>
                    <dx:BootstrapGridViewTextColumn FieldName="CityName" VisibleIndex="2" Caption="City"></dx:BootstrapGridViewTextColumn>
                    <dx:BootstrapGridViewCommandColumn ShowClearFilterButton="true" ShowApplyFilterButton="true" VisibleIndex="3" />
                </Columns>
                    
            </dx:BootstrapGridView>