Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: GridView SelectedIndexChanged question

Reply
Thread Tools

Re: GridView SelectedIndexChanged question

 
 
Alexey Smirnov
Guest
Posts: n/a
 
      10-24-2009
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView SelectedIndexChanged question David C ASP .Net 11 10-26-2009 10:04 PM
Gridview - Issue with selectedindexchanged graphicsxp ASP .Net 0 07-11-2006 09:37 AM
Raising SelectedIndexChanged event in a gridview =?Utf-8?B?LU1U?= ASP .Net 2 06-06-2006 07:32 PM
GridView SelectedIndexChanged value sck10 ASP .Net 1 04-03-2006 09:07 AM
SelectedIndexChanged event not responding on selecting gridview =?Utf-8?B?QVQ=?= ASP .Net 1 04-01-2005 09:37 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57