how to disabled each items in gridview according to the textbox text?
if booking closed column values is equal or more than textbox1 text then the book button in gridview will be disabled for each gridview item whose booking closed time is greater and equal to text开发者_StackOverflow中文版box1 time ..
How to do that ?
M using VS 2008 and vb
You should handle this issue in the rowbound event handler of the GridView.
Update #1
protected void books_RowDataBound(object sender, GridViewRowEventArgs e) {
if(e.Row.RowType == DataControlRowType.DataRow) {
//Do this only if the textbox value is ....
Button btn = (( GridView )sender).FindControl("button");
btn.Enabled = false;
}
}
Update #2
Protected Sub books_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
'Do this only if the textbox value is ....
Dim btn As Button = DirectCast(sender, GridView).FindControl("button")
btn.Enabled = False
End If
End Sub
精彩评论