lapucca
asked on
My asp.net button is still not enabled even when I set it to enabled
Hi, I'm using vs2008, .net
The breakpoint is set at this loc and it's executed but the update button is still not ablled. How can I address this? thank you.
both buttons are not abled even code is executed and I can see the property is set to be abled. I refresh the page again and nothing changes.
The breakpoint is set at this loc and it's executed but the update button is still not ablled. How can I address this? thank you.
both buttons are not abled even code is executed and I can see the property is set to be abled. I refresh the page again and nothing changes.
Protected Sub gvWorkingDocs_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvWorkingDocs.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
' Get the DataKey Value of the grid row
Dim newFileName As String
newFileName = gvWorkingDocs.DataKeys(e.Row.RowIndex).Value.ToString()
Dim updateButton As System.Web.UI.WebControls.Button
Dim editButton As System.Web.UI.WebControls.Button
'If a match is found then the doc is checked out
For i As Integer = 0 To dsDocsLogs.Tables(0).Rows.Count - 1
If dsDocsLogs.Tables(0).Rows(i)("NewFileName").ToString() = newFileName Then
'Fill in the status info
e.Row.Cells(8).Text = "Checked out by " + dsDocsLogs.Tables(0).Rows(i)("userName").ToString() & _
" @" + dsDocsLogs.Tables(0).Rows(i)("dateTime").ToString()
'Enable or Disable Update and Edit button
If dsDocsLogs.Tables(0).Rows(i)("userId").ToString() = userId Then
updateButton = CType(e.Row.FindControl("editWorkingDoc"), System.Web.UI.WebControls.Button)
updateButton.Enabled = True
Else 'else, disable the Edit button
editButton = CType(e.Row.FindControl("btnUpdate"), System.Web.UI.WebControls.Button)
editButton.Enabled = False
End If
End If
Next
End If
End Sub
Can you put breakpoints at line 17 in you question code snippet?
Tell me what these values are when program stop in the breakpoint:
dsDocsLogs.Tables(0).Rows( i)("NewFil eName").To String()
newFileName
dsDocsLogs.Tables(0).Rows( i)("userId ").ToStrin g()
userId
If not hit in the breakpoint try line 11. you may have a problem when comparing the strings. (eg. case, match exactly)
Tell me what these values are when program stop in the breakpoint:
dsDocsLogs.Tables(0).Rows(
newFileName
dsDocsLogs.Tables(0).Rows(
userId
If not hit in the breakpoint try line 11. you may have a problem when comparing the strings. (eg. case, match exactly)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
These are hit alright. I copy the value from debug anyway just to show you. Yeah, the loc is definitly executed for setting the updateButton to Enabled but it still shows up disabled. Thanks.
dsDocsLogs.Tables(0).Rows( i)("NewFil eName").To String() "300-4A-09-1CTU_HS-09-0048 9_10-22-09 -102920091 35102.doc" String
newFileName "300-4A-09-1CTU_HS-09-0048 9_10-22-09 -102920091 35102.doc" String
dsDocsLogs.Tables(0).Rows( i)("userId ").ToStrin g() "AlphaDavis" String
userId = "AlphaDavis"
dsDocsLogs.Tables(0).Rows(
newFileName "300-4A-09-1CTU_HS-09-0048
dsDocsLogs.Tables(0).Rows(
userId = "AlphaDavis"
ASKER
Good catch! Yeah, the stupid bug kept me working on this for like a couple hours already! Thank you!
Really Glad that i was able to help you out.
ASKER
Open in new window