开发者

Disabled all the records book button in gridview1 whose name column values is sumit?

开发者 https://www.devze.com 2023-01-31 19:40 出处:网络
I have TextBox1 whose Default text is Sumit and a gridview with records and button field in each row ..

Disabled all the records book button in gridview1 whose name column values is sumit?

I have TextBox1 whose Default text is Sumit and a gridview with records and button field in each row ..

On Page load event

I want if textbox1 text is Sumit .... then all the records in gridview1 whose name column values is sumit .... then that rows Book button will be disabled and rest of all will be remain as it is in Enableed form ...

i m using Visual Studio 2008 with vb

Is this coding is right : ?

Protected Sub GridView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.DataBound
        For Each myRow As GridViewRow In GridView1.Rows
            'Find the checkbox
            Dim lab1 As Label = DirectCast(myRow.FindControl("Label1"), Label)
            If lab1.Text = "Sumit" Then
                'Find the Delete linkbutton and hide it
                Dim deleteButton As Button = DirectCast(myRow.FindControl("Button1"), Button)
                deleteButton.Enabled = False
            End If
    开发者_高级运维    Next
    End Sub

But this coding doesn't disabled the button .... in rows whose name field is Sumit


In the grid view item data bound eventhandler, set button.Enabled = false if "name" in the dataitem is sumit.

0

精彩评论

暂无评论...
验证码 换一张
取 消