Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DevExpress GridView - Saving data back to SQL Server
Message
 
 
To
11/05/2016 12:52:27
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 4.0
Database:
MS SQL Server
Miscellaneous
Thread ID:
01636167
Message ID:
01636169
Views:
69
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform