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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:38:17+00:00 2026-05-22T22:38:17+00:00

I have a page using ASPxGridView and to fill the GridView I use a

  • 0

I have a page using ASPxGridView and to fill the GridView I use a LinqServerModeDataSource control who fetches it data through a SQL View from a MS SQL Server. So far so good but here comes the problem.

I want to insert data in the database so I’m building a custom form

<Templates>
    <EditForm>
        Company Name: <dx:ASPxTextBox ID="CompanyName" runat="server" />
        Company Mail: <dx:ASPxTextBox ID="Email" runat="server" />

        <dx:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server" />
        <dx:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server" />

    </EditForm>
</Templates>

Here is an example of the custom form

Example

Pretty basic stuff, in this scenario the Company name goes to one table and the email to another. This is all handled by calling a Stored Procedure. Or thats the plan.

Does anyone know how to do this?

It feels like I’ve been trying it all, LinqServerModeDataSource1_Inserting, ASPxGridView1_RowInserting and so on but nooo. Here is one of the failing codes. And the devexpress documentation is even worse, but lets not go there its not a happy place.

protected void LinqServerModeDataSource1_Inserting(object sender, DevExpress.Data.Linq.LinqServerModeDataSourceEditEventArgs e)
{
    // Some magic to insert data here
    ASPxGridView1.CancelEdit();
}

So, any advice or help is highly appreciated.

Thanks!

  • 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-22T22:38:17+00:00Added an answer on May 22, 2026 at 10:38 pm

    “I want to insert data in the database so I’m building a custom form” ASPxGridView can do all that for you without you having to make a custom template at least with sqldb
    If i would define a delete command and or edit command below to the sqldatasource i could already delete and edit the information in the gridview

      <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" 
            ClientIDMode="AutoID" DataSourceID="SqlDataSource1">
            <Columns>
                <dx:GridViewCommandColumn VisibleIndex="0">
                    <EditButton Visible="True">
                    </EditButton>
                    <NewButton Visible="True">
                    </NewButton>
                    <DeleteButton Visible="True">
                    </DeleteButton>
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn FieldName="Naam" VisibleIndex="0">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="Adres" VisibleIndex="1">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="Postcode" VisibleIndex="2">
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn FieldName="Plaats" VisibleIndex="3">
                </dx:GridViewDataTextColumn>
            </Columns>
        </dx:ASPxGridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            SelectCommand="SELECT [Name], [Address], [Postcode], [City] FROM [Somewhere]">
        </asp:SqlDataSource>
    

    But you can if you really want to use a custom made insert or delete

    protected void ASPxGridView4_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
    {
        DataColumn[] esl = new DataColumn[] { dt.Columns["SQLWaarde"] };
        if (ds.Tables[0].PrimaryKey == null || ds.Tables[0].PrimaryKey == esl)
        {
            ds.Tables[0].PrimaryKey = new DataColumn[] { dt.Columns["SQLWaarde"] };
        }
        DataRow[] delRow = ds2.Tables[0].Select("IndWaardeType = '" + e.Values[1] + "' AND SQLWaarde = '" + e.Values[2] + "'");
        ds2.Tables[0].Rows.Remove(delRow[0] as DataRow);
    
        e.Cancel = true;
        ASPxGridView4.CancelEdit();
        Session["ds2"] = ds2;
    }
    protected void ASPxGridView4_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ndr2 = ds2.Tables[0].NewRow();
        ndr2[0] = e.NewValues[0];
        ndr2[1] = e.NewValues[1];
        ndr2[2] = e.NewValues[2];
        ds2.Tables[0].Rows.Add(ndr2);
    
        e.Cancel = true;
        ASPxGridView4.CancelEdit();
        Session["ds2"] = ds2;
    }
    

    That’s how i did it last time. I made use of datatables and stored that in sessions bla bla realy just trying out but it works alright.

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

Sidebar

Related Questions

i have a web page using a css style file who have this property:
I have an iPhone application where i'm showing a settings page using modal view
I have a page using <ul> lists for navigation (Javascript changes the styling to
I have a ASP.Net page using ADO to query MS access database and as
I have a page that is using a non-standard font and arial as a
I have a page that is currently using the datetime microformat to display a
I have an ASPX page (On server A) which is invoked using NTLM credentials.
I have a web page that is being displaying in a winform app using
I have created a user login page and am using Forms Authentication. Users are
We have an HTML page which displays a bunch of pretty bars using divs

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.