Click here to Skip to main content
15,914,010 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

I am using checklist on a GridView control which gets bool value from the database.

It work fine.

I want to do it in such a way that if the checklist in the manager's colunm is checked then a server control (textbox) visible property must be false.

How do I go about this.

Thanks in advance!
Posted
Updated 7-Sep-10 12:03pm
v2
Comments
Sandeep Mewara 11-May-10 14:00pm    
So, we got what you want. What is the issue that you are facing doing it? Did you try?
Dalek Dave 7-Sep-10 18:04pm    
Minor Edit for Spelling.

I'm doing something like this right after I bind the data in a GridView to populate links. There is probably a better way.

Off the top of my head, you could try something like this:
C#
foreach (GridViewRow gvr in dgSupervisor2.Rows)
{
    CheckBox selectedCheckbox = (LinkButton)gvr.FindControl("checkBox");
    if (selectButton != null)
    {
        int i = gvr.RowIndex;
        TableCellCollection MyCells = Manager.Rows[i].Cells;
        TextBox ToDisable = MyCells[5]; //Adjust this number to the column location of the textbox

        if (selectedCheckbox.Checked == true)
            {
                ToDisable.Enabled = false;
            }
     }

}

But check to make sure my syntax is right.
 
Share this answer
 
v3
Somebody please tell me why this code is not working:

Protected Sub nextOfKinGridView_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles nextOfKinGridView.RowUpdating

Dim _nextofkinid As Int32 = CInt(Me.nextOfKinGridView.Rows(e.RowIndex).Cells(0).Text) 'Next Of Kin ID
Dim _Surname As String = CType(nextOfKinGridView.Rows(e.RowIndex).Cells(1).Controls(0), TextBox).Text
Dim _FirstName As String = CType(nextOfKinGridView.Rows(e.RowIndex).Cells(2).Controls(0), TextBox).Text
Dim _OtherNames As String = CType(nextOfKinGridView.Rows(e.RowIndex).Cells(3).Controls(0), TextBox).Text
Dim _ContactAddress As String = CType(nextOfKinGridView.Rows(e.RowIndex).Cells(4).Controls(0), TextBox).Text
Dim _Telephone As String = CType(nextOfKinGridView.Rows(e.RowIndex).Cells(5).Controls(0), TextBox).Text
Dim _Email As String = CType(nextOfKinGridView.Rows(e.RowIndex).Cells(6).Controls(0), TextBox).Text
Dim _Relationship As String = CType(nextOfKinGridView.Rows(e.RowIndex).Cells(7).Controls(0), TextBox).Text

Try
BAL.Recruitment.UpdateEmployeeNextOfKin(_nextofkinid, _Surname, _FirstName, _OtherNames, _ContactAddress, _Telephone, _
_Email, _Relationship)

nextOfKinGridView.EditIndex = -1
BindNextOfKinGridview()
Catch ex As Exception
Me.kinMessageLabel.Text = ex.Message()
End Try

End Sub
 
Share this answer
 
Comments
Toli Cuturicu 7-Sep-10 14:20pm    
Reason for my vote of 1
What is this? A programming language??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900