On Oct 24, 3:12*pm, Alexey Smirnov <alexey.smir...@gmail.com> wrote:
> On Oct 24, 2:59*pm, "David C" <dlch...@lifetimeinc.com> wrote:
>
>
>
>
>
> > I have a GridView that I want to show or hide LinkButtons that exist outside
> > of the GridView based on a data column in the GridView when that row is
> > selected. *I have the code below for the SelectedIndexChanged event but it
> > always falls through to the False condition. *The data column named
> > VoidCheck is a SQL Server bit data type. *Can someone help me spot the
> > problem? *Thanks in advance.
>
> > David
>
> > * * Protected Sub gvVendorChecks_SelectedIndexChanged(ByVal sender As
> > Object, ByVal e As System.EventArgs) Handles
> > gvVendorChecks.SelectedIndexChanged
> > * * * * ' Get the currently selected row using the SelectedRow property.
> > * * * * Dim row As GridViewRow = gvVendorChecks.SelectedRow
>
> > * * * * If row.RowState = DataControlRowState.Selected Then
> > * * * * * * Dim bolvoid As Boolean =
> > Convert.ToBoolean(DataBinder.Eval(row.DataItem, "VoidCheck"))
> > * * * * * * If bolvoid = True Then
> > * * * * * * * * ' voided check selected so show the remove void button
> > * * * * * * * * LBtnRemoveVoid.Visible = True
> > * * * * * * * * LBtnVoidCheck.Visible = False
> > * * * * * * Else
> > * * * * * * * * LBtnRemoveVoid.Visible = False
> > * * * * * * * * LBtnVoidCheck.Visible = True
> > * * * * * * End If
> > * * * * End If
> > * * End Sub
>
> The RowType property is a bitwise combination of the values and not a
> boolean. Either remove
>
> ** If row.RowState = DataControlRowState.Selected Then **
>
> because it makes no sense, or replace it by
>
> ** If (row.RowState And DataControlRowState.Edit) > 0 Then **
>
> Hope this helps.- Hide quoted text -
>
> - Show quoted text -
P.S.
Please see more at
http://msdn.microsoft.com/en-us/libr....rowstate.aspx