Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Show and Hide embedded GridView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David C - 28 Sep 2007 18:45 GMT
I have a GridView of contacts that contains an embedded gridview of multiple
phones for that particular contact.  I have a LinkButton on the contacts
GridView that refers to the Select command and when I click it the embedded
GridView of phones becomes visible.  Now I would like to have it toggle so
that if the embedded GridView is visible, it will become Visible = False.
Below is the code I have but it creates an error "Object reference not set
to an instance of an object" c on the first IF statement.  Can someone
advise?  Code is below:

   Protected Sub LBtnMorePhones_Click(ByVal sender As Object, ByVal e As
CommandEventArgs)
       txtcnid.Text = e.CommandArgument
       Dim row As GridViewRow = gvContacts.SelectedRow
       If Not row.FindControl("gvMorePhones") Is Nothing Then
           Dim varControl
           varControl = row.FindControl("gvMorePhones")
           If Not varControl Is Nothing Then
               varControl.Visible = Not varControl.Visible
           End If
       End If
   End Sub
nothingsoriginalontheinternet@gmail.com - 29 Sep 2007 01:16 GMT
I believe gvContacts.SelectedRow is not returning anything.

Maybe a possible workaround is to handle the OnLoad event with the
OnLoad attribute of the phone numbers gridview, and work your way out
instead of in to find if the row that contains it is selected.

-Mike Placentra II

> ...error "Object reference not set
> to an instance of an object" c on the first IF statement.  Can someone
[quoted text clipped - 3 lines]
>         Dim row As GridViewRow = gvContacts.SelectedRow
> ...

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.