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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:59:11+00:00 2026-06-14T22:59:11+00:00

I’m using ASPxGridView and updating with data from DataTable which, works fine. But when

  • 0

I’m using ASPxGridView and updating with data from DataTable which, works fine.
But when I’m trying to use edit, update, delete, paging, sorting functions I get in trouble.
The buttons are displayed but the function doesn’t work when I click them.

Here is my Sample.aspx file:

[ASPx]

<dx:aspxgridview ID="grid" ClientInstanceName="grid" runat="server" 
        OnDataBinding="grid_DataBinding" Width="100%" EnableCallBacks="false">        
    
    <Settings ShowTitlePanel="True" />
    <SettingsText Title="Tabla" />
    <SettingsPager PageSize ="10" ShowSeparators="true" PageSizeItemSettings-Items="20" >
        <PageSizeItemSettings Visible="true" />            
    </SettingsPager>
    
</dx:aspxgridview>

The code behind Sample.aspx.cs :

[C#]

using System;
using System.Data;
using System.Web.Mvc;
using DataConnector;
using DevExpress.Web.ASPxGridView;
using DevExpress.Web.Data;

namespace Sample.Views.Actions

{

    public partial class Sample: ViewPage
    {

        private DataTable dt;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                grid.DataBind();

            grid.RowValidating += new ASPxDataValidationEventHandler(grid_RowValidating);

            if (!this.IsPostBack)
            {
                GridViewCommandColumn c = new GridViewCommandColumn();
                grid.Columns.Add(c);                
                c.Caption = "Operations";

                c.EditButton.Visible = true;
                c.UpdateButton.Visible = true;
                c.NewButton.Visible = true;
                c.DeleteButton.Visible = true;
                c.CancelButton.Visible = true;
            }            
        }        

        DataTable BindGrid()
        {
            DataConnection DM = new DataConnection();
            if (DM.login("ADMIN", "PASS"))
            
                dt = DM.getDataSet("SELECT * FROM Table_Name");
                grid.DataSource = dt;
                dt.PrimaryKey = new DataColumn[] { dt.Columns[0] };       
            
            return dt;
        }

        protected void grid_DataBinding(object sender, EventArgs e)
        {
            // Assign the data source in grid_DataBinding
            BindGrid();
        }

        protected void grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            int id = (int)e.OldValues["id"];
            DataRow dr = dt.Rows.Find(id);
            dr[0] = e.NewValues[""];
            dr[1] = e.NewValues[""];
            dr[2] = e.NewValues[""];
            dr[3] = e.NewValues[""];
            dr[4] = e.NewValues[""];

            ASPxGridView g = sender as ASPxGridView;
            UpdateData(g);
            g.CancelEdit();
            e.Cancel = true;
        }


        void grid_RowValidating(object sender, ASPxDataValidationEventArgs e)
        {
            int id = (int)e.NewValues["id"];
            if ((!e.OldValues.Contains("id") || ((int)e.OldValues["id"] != id))
                && (dt.Rows.Find(id) != null))
            {
                ASPxGridView grid = sender as ASPxGridView;
                e.Errors[grid.Columns["id"]] = String.Format("Column 'Id' is constrained to be unique.  Value '{0}' is already present.", id);
            }
        }


        private void UpdateData(ASPxGridView g)
        {
            g.DataBind();
        }
    }}

The Sample is called on the controller page:

[C#]

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data;
using DataConnector;

namespace Sample.Controllers

{    
public class ActionsController : Controller

    {
        
        public ActionResult Sample()
        {
            return View();
        }

    }
}

The data displayed on the Grid.

I created a new solution where is only the Sample.aspx and Sample.aspx.cs and I’m using without MVC and the functions are working. The difference is "public partial class Sample: System.Web.UI.Page ".
If I try without System.Web.UI.Page on my mentioned code it gives me the following error:

The view must derive from ViewPage, ViewPage<TModel>, ViewuserControl,or ViewuserControl<TModel>.

What am I doing wrong? Why does not the function of the ASPxGridView working?

I’m sorry in advance if it is poorly drafted but not my mother tongue is English, and I am a new programmer 🙂

  • 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-14T22:59:12+00:00Added an answer on June 14, 2026 at 10:59 pm

    The ASPxGridView is a WebForms control and cannot be used within ASP.NET MVC. Instead you should use the DevExpress MVC extensions. Specifically, the DevExpress MVC GridView extension

    Watch my “Getting started with DevExpress MVC video” to learn more.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a text area in my form which accepts all possible characters from
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to construct a data frame in an Rcpp function, but when I
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.