| |

VerySource

 Forgot password?
 Register
Search
View: 544|Reply: 3

Does the GirdView1.Columns.Insert method conflict with the RowCommand event?

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-4 19:10:01
| Show all posts |Read mode
Add a BoundField to the compilation method, use the Insert method to add to the GirdView's Columns, and the RowCommand event of the GirdView will not work. Use the add method to add to the Columns of the GirdView, and the RowCommand event will work. Strange. The button column is fixed.

Insert method
System.Web.UI.WebControls.BoundField bf = System.Web.UI.WebControls.BoundField ();
bf.HeaderText = "Sales Header";
bf.DataField = "SalesTitle";
GirdView1.Columns.Insert (1, bf);

Add method
System.Web.UI.WebControls.BoundField bf = System.Web.UI.WebControls.BoundField ();
bf.HeaderText = "Sales Header";
bf.DataField = "SalesTitle";
GirdView1.Columns.add (bf);
Reply

Use magic Report

0

Threads

64

Posts

35.00

Credits

Newbie

Rank: 1

Credits
35.00

 China

Post time: 2020-1-4 19:12:02
| Show all posts
When was your GirdView1.Columns.Insert (1, bf); executed and when was it not executed?

Add does not destroy the position information of the original columns (ClientID, UniqueID), but if your Insert is executed at the wrong time, it will change the position of the control automatically generated after the insertion.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-5 05:24:01
| Show all posts
GirdView1.Columns.Insert () does not have a special run position. Just when the button is clicked, the GirdView changes and the fixed button columns are empty. The button column is not automatically generated, it is written directly in aspx.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-30 13:00:01
| Show all posts
up
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