| |

VerySource

 Forgot password?
 Register
Search
View: 683|Reply: 4

Urgent help: detailsview control, generate data source with SQL, no data in custom update event processing?

[Copy link]

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 France

Post time: 2020-3-2 21:00:02
| Show all posts |Read mode
The detailsview control uses SQL to generate a data source. How can I obtain the updated data in the detailsview control during custom update event processing?
    protected void GridView1_OnRowUpdating (object sender, GridViewUpdateEventArgs e)
    {
        for (int i = 0; i <e.NewValues.Count; i ++)
        {
            if (e.NewValues ​​[i]! = null)
            {
                e.NewValues ​​[i] = Server.HtmlEncode (e.NewValues ​​[i] .ToString ());
            }
        }
    }
e.newValues ​​[i] is all empty and there is no row. Why?
Reply

Use magic Report

0

Threads

119

Posts

67.00

Credits

Newbie

Rank: 1

Credits
67.00

 United States

Post time: 2020-5-14 19:00:01
| Show all posts
ItemUpdating
Occurs when the Update button in the DetailsView control (the button whose CommandName property is set to "Update") is clicked, but before the update operation.

ItemUpdated
Occurs when the Update button in the DetailsView control is clicked, but after the update operation.
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-18 20:15:01
| Show all posts
To use two-way binding <% Bind ()%>, there will be values ​​in e.NewValues
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-5-18 20:45:01
| Show all posts
If the problem cannot be solved, please post your HTML
Reply

Use magic Report

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-7-22 08:00:01
| Show all posts
The sqldatasource I used, directly assigned values ​​to the selectcommand and updatecommand of the sqldatasource in the page_load event, realized. Thank you for your enthusiastic advice!

I recently encountered another problem: I want to determine which cells the user has selected in the table, and process other tables in the database based on the contents of the selected cells. How to realize this function?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list