| |

VerySource

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

Get the value of a column of the current line in GridView

[Copy link]

3

Threads

14

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2021-4-22 15:00:04
| Show all posts |Read mode
Protected void GridView1_rowcreated (Object Sender, GridViewRoweventargs E)
    {
        IF (E.Row.RowType == DatacontrolrowType.DataRow)
        {
            Button but = (button) E.Row.FindControl ("BT");
            But.text = E.Row.cells [1] .Text;
            Response.write (E.Row.cells [1] .text);
            
        }
    }
No display, is it my mistake? `Please help us to see``
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2021-4-22 20:45:01
| Show all posts
Didn't see it, is it worthless of your column?
Reply

Use magic Report

3

Threads

14

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2021-4-22 21:15:01
| Show all posts
Have ah`` to read it from the database`
Reply

Use magic Report

3

Threads

14

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 Great Britain

 Author| Post time: 2021-4-22 21:45:01
| Show all posts
Protected void GridView1_rowcreated (Object Sender, GridViewRoweventargs E)
    {
        IF (E.Row.RowType == DatacontrolrowType.DataRow)
        {
            For (int i = 1; i <gridview1.rows.count; i ++)
            {
                Button but = (button) E.Row.FindControl ("BT");
                GridViewrow DROW = GridView1.Rows [i];
                String s = drow.cells [1] .TEXT;
                But.text = s;
                Response.write (i);
            }
         
        }
    }
The first BUT TEXT is empty, how is the data behind it? `Standarded one`
Reply

Use magic Report

3

Threads

14

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2021-4-22 22:15:02
| Show all posts
The initial value of i is 0`
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