| |

VerySource

 Forgot password?
 Register
Search
View: 714|Reply: 2

(SOLVED) Extract the current row value of the linkbutton in DateGrid?

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-6 13:10:01
| Show all posts |Read mode
In DateGrid
How to mention the value of the line where the linkbutton is located?

Or delete button in DateGrid, how to delete the information of the current row?
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-1-6 14:54:01
| Show all posts
protected void DataGrid1_ItemCommand (object source, DataGridCommandEventArgs e)
    {
        DataRowView row = (DataRowView) e.Item.DataItem;
    }
row represents the row of the DataView bound to that row.

If you want to take the value row ["field"].
Reply

Use magic Report

0

Threads

15

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-6 15:00:01
| Show all posts
e.Item.RowIndex
It is recommended to put hidden on this line. Then use findcontrol.
1. Add on the linkbutton template column
<input type = "hidden" id = "hidPK" runat = "server" value = '<% # Eval ("PKFieldName")%>'>
2. In the rowCommand event
HtmlInputHidden hidPk = e.Item.FindControl ("hidPK") as HtmlInputHidden;
dbaccess.Delete (hidPk.Value);
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