Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DevExpress GridView - Saving data back to SQL Server
Message
 
 
À
11/05/2016 12:52:27
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 4.0
Database:
MS SQL Server
Divers
Thread ID:
01636167
Message ID:
01636169
Vues:
66
>Hi,
>
>I'm struggling with an ASP.NET application that I inherited. The original developer tended to do things like this to save data:
>
>
            RESREPRICERDataSetTableAdapters.PNRsTableAdapter _adapt = new RESREPRICERDataSetTableAdapters.PNRsTableAdapter();
>            RESREPRICERDataSet.PNRsDataTable _table = null;
>
>            _table = _adapt.GetDataByPNR(Request.QueryString["PNR"]);
>
>            if (_table.Rows.Count == 0)
>	        {
>                // new record
>                _adapt.Insert(SQLGuidUtil.NewSequentialId(), Request.QueryString["PNR"], ticketStatus, txtRemarks.Text, savings);
>	        }
>            else
>	        {
>                //existing record
>                RESREPRICERDataSet.PNRsRow _row = (RESREPRICERDataSet.PNRsRow)_table.Rows[0];
>
>                _adapt.Update(Request.QueryString["PNR"], ticketStatus, txtRemarks.Text, savings, _row.GUID);
>	        }
>
>
>I am now trying to use the DevExpress GridView that he used in the project for editing the data. I've never done a system like this (ASP.NET) before so there is a lot of learning to take place, feel free to guide me to suitable sites.
>
>I've created a couple SQLDataSources and set the main grid view to use one of them. Then the editform template (a one to many scenario) binds some fields to the data, and there is a second gridview which uses the other datasource to display the related many side of the data. I have added in a button to save which should send the changes on the form back to the database.
>
>I have 2 questions:
>
>1. How do I actually save the data? Do I just need to SqlDataSource1.Update()?
>
>2. How do I get my code that saves the data to be called?
>
>This is the Save button:
>
>
<dx:ASPxButton ID="submitButton" runat="server" Text="Save" Width="100" AutoPostBack="false">
>                                    <ClientSideEvents Click="onSubmit" />
>
>onSubmit is javascript defined like this:
>
>
        function onSubmit(s, e) {
>            gv1.UpdateEdit();
>        }
I think SqlDataSource is a very old technology. I know we used them in ~ 2007. Check ASP.NET forums, you'll find plenty of examples.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform