|
Prev: DataList and GridView problem, please help
Next: Determine Which version of .NET Framework Is Being Used
From: Plateriot on 3 Jul 2008 22:09 I have link buttons in a Gridview that, depending on the value in another column (Not the Key column) will need to be disabled. For example, (Column2 has link buttons) Column1 Column2 Books 54 Videos 6 Audio 3 I don't want Column2 to be clickable (i.e. "act like a link button) if Column1's Value is "Audio" I also have the need to disable Every single link button in the grid based on another value on the page - but I'll be able to do that if I can figure out how to do the first part. How can I do this?
From: Christiano on 4 Jul 2008 07:37 the easiest way for me is to make a conditional on the onclick event, that checks if column1 is clicked, then, exit sub... or in the rowcommand event: dim col1 as checkbox = ctype(gridview.findcontrol(button1), checkbox) dim col2 as button = ctype(gridview.findcontrol(button2), button) if col1.checked=true then col2.enable = false else col2.enable = true end if i think the might work.. [ ]'s Christiano. "Plateriot" <Plateriot(a)discussions.microsoft.com> escreveu na mensagem news:94897F79-7A70-4A47-9025-90B462AF1970(a)microsoft.com... >I have link buttons in a Gridview that, depending on the value in another > column (Not the Key column) will need to be disabled. > > For example, (Column2 has link buttons) > > Column1 Column2 > Books 54 > Videos 6 > Audio 3 > > > I don't want Column2 to be clickable (i.e. "act like a link button) if > Column1's Value is "Audio" > > > I also have the need to disable Every single link button in the grid based > on another value on the page - but I'll be able to do that if I can > figure > out how to do the first part. > > How can I do this?
From: Plateriot on 4 Jul 2008 12:56 Thank you. That did the trick. "Christiano" wrote: > the easiest way for me is to make a conditional on the onclick event, that > checks if column1 is clicked, then, exit sub... > > or > > in the rowcommand event: > dim col1 as checkbox = ctype(gridview.findcontrol(button1), checkbox) > dim col2 as button = ctype(gridview.findcontrol(button2), button) > > if col1.checked=true then > col2.enable = false > else > col2.enable = true > end if > > > i think the might work.. > > > [ ]'s > Christiano. > > > > > > > > > "Plateriot" <Plateriot(a)discussions.microsoft.com> escreveu na mensagem > news:94897F79-7A70-4A47-9025-90B462AF1970(a)microsoft.com... > >I have link buttons in a Gridview that, depending on the value in another > > column (Not the Key column) will need to be disabled. > > > > For example, (Column2 has link buttons) > > > > Column1 Column2 > > Books 54 > > Videos 6 > > Audio 3 > > > > > > I don't want Column2 to be clickable (i.e. "act like a link button) if > > Column1's Value is "Audio" > > > > > > I also have the need to disable Every single link button in the grid based > > on another value on the page - but I'll be able to do that if I can > > figure > > out how to do the first part. > > > > How can I do this? > > >
From: Plateriot on 4 Jul 2008 15:57
I tried to add more conditions and it seems picky about them --- For example, the first working thing I tried was to set the value I was checking into a string variable -- that was strMeasure I tried 2 others, (strTotLeft and strMissOpp) but it just seems to ignore the code. Here's my current complete code If e.Row.RowType = DataControlRowType.DataRow Then Dim MeasureTitle As TableCell = e.Row.Cells(0) Dim MissOppVal As TableCell = e.Row.Cells(1) Dim TotLeftVal As TableCell = e.Row.Cells(2) Dim lnkTotalLeft As LinkButton = CType(e.Row.Cells(2).Controls(0), LinkButton) Dim lnkMissedOpp As LinkButton = CType(e.Row.Cells(1).Controls(0), LinkButton) Dim strMeasure As String Dim strMissOpp As String Dim strTotLeft As String e.Row.Cells(7).Visible = False strMeasure = MeasureTitle.Text strMissOpp = MissOppVal.Text strTotLeft = TotLeftVal.Text 'Any Aliased provider should be a disabled link If Left(Me.cmbPCP.SelectedItem.Text, 2) = "ZZ" Then lnkTotalLeft.Enabled = False 'link buttons should be disabled for certain measures ElseIf strMeasure = "Percent of Care Gaps Closed" Then lnkTotalLeft.Enabled = False lnkMissedOpp.Enabled = False 'link buttons should be disabled if value is N/A ElseIf strMissOpp = "N/A" Then lnkMissedOpp.Enabled = False ElseIf strTotLeft = "N/A" Then lnkTotalLeft.Enabled = False Else 'otherwise, link button can be enabled lnkTotalLeft.Enabled = True lnkMissedOpp.Enabled = True End If End If Thank you for your suggestion - at least it got me moving. "Christiano" wrote: > the easiest way for me is to make a conditional on the onclick event, that > checks if column1 is clicked, then, exit sub... > > or > > in the rowcommand event: > dim col1 as checkbox = ctype(gridview.findcontrol(button1), checkbox) > dim col2 as button = ctype(gridview.findcontrol(button2), button) > > if col1.checked=true then > col2.enable = false > else > col2.enable = true > end if > > > i think the might work.. > > > [ ]'s > Christiano. > > > > > > > > > "Plateriot" <Plateriot(a)discussions.microsoft.com> escreveu na mensagem > news:94897F79-7A70-4A47-9025-90B462AF1970(a)microsoft.com... > >I have link buttons in a Gridview that, depending on the value in another > > column (Not the Key column) will need to be disabled. > > > > For example, (Column2 has link buttons) > > > > Column1 Column2 > > Books 54 > > Videos 6 > > Audio 3 > > > > > > I don't want Column2 to be clickable (i.e. "act like a link button) if > > Column1's Value is "Audio" > > > > > > I also have the need to disable Every single link button in the grid based > > on another value on the page - but I'll be able to do that if I can > > figure > > out how to do the first part. > > > > How can I do this? > > > |