Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Show and Hide embedded GridView

Reply
Thread Tools

Show and Hide embedded GridView

 
 
David C
Guest
Posts: n/a
 
      09-28-2007
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


 
Reply With Quote
 
 
 
 
nothingsoriginalontheinternet@gmail.com
Guest
Posts: n/a
 
      09-29-2007
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


On Sep 28, 1:45 pm, "David C" <(E-Mail Removed)> wrote:
> ...error "Object reference not set
> to an instance of an object" c on the first IF statement. Can someone
> advise? Code is below:
>
> ...
> Dim row As GridViewRow = gvContacts.SelectedRow
> ...


 
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
show hide divs - show last state upon reload/post ll Javascript 2 05-01-2008 12:15 PM
Dynamically show/hide gridview footer? gnewsgroup ASP .Net 0 10-23-2007 03:05 AM
Ajax: UpdatePanel to show/hide Gridview Reinhard ASP .Net 0 06-03-2007 10:35 AM
Javascript Hide/Show for Embedded Objects zootskill@hotmail.com Javascript 0 01-20-2005 10:28 PM
eMbedded Visual C++, hide/show toolbars Sandra C++ 2 11-08-2004 10:21 AM



Advertisments