Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make cells editable and convenient for users to use by GridView controls in Asp.net

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the Asp.net GridView control how to achieve cell editable and convenient for users to use, the article is very detailed, has a certain reference value, interested friends must read it!

Recently do a function, taking into account the convenience of users, reduce the number of pop-up pages, use the "Edit" button without popping up the page directly to edit the contents of the current row of cells. The entry page is displayed as follows:

Click the "Edit" button and display as follows:

Both "week" and "whether to go to work" numbered 1 can be edited. After editing, click "Update" to save.

The data loading in the first figure is achieved by the following methods:

Protectedvoid GridView_RowDataBound (object sender, GridViewRowEventArgs e)

{. }

The modified data in the second figure is achieved in the following ways:

ProtectedvoidGridView_Pue_RowUpdating (object sender, GridViewUpdateEventArgs e)

{. }

I thought it could be done in this way, but who knew there was a "fire unhandled event RowEditing" error on the update button:

Added to GridView

ProtectedvoidGridView_RowEditing (object sender, GridViewEditEventArgs e)

{. }

Solve this problem, but you need to click the Edit button twice each time to see the interface shown in figure 2. The first time you debug the edit button, you jump into the GridView_RowEditing method and add code to it:

GridView.EditIndex= e.NewEditIndex

BindGrid ()

Solve the problem

The above is all the contents of the article "how to make the GridView control in Asp.net editable and easy for users to use". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report