473,394 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Show and Hide embedded GridView

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
Sep 28 '07 #1
1 2529
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" <dlch...@lifetimeinc.comwrote:
...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
...
Sep 29 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sandra | last post by:
Hello, I want to develop an application for WindowsCE using eMbedded Visual C++ 4.0. Is it possible to add/delete or hide/show toolbars by running the application. e.g. the user choose a menuitem...
12
by: Jerad Rose | last post by:
I searched for a while trying to find the answer to this, but to no avail. I am trying to find the best way (or any way) to dynamically show and hide groups of TR's. For example, I have a...
3
by: | last post by:
I'm using the DataList and GridView controls, and I am trying to wrap my head around the problem of conditionally showing or hiding cells/cell content based on the presence or absence of DB data. I...
2
by: Keithb | last post by:
I need to hide a GridView's "edit" column if the user's role does not support editing. However, the column's Visible property does not support databinding. Is there a workaround? Thanks, ...
0
by: Reinhard | last post by:
Hi, Need some directions on Ajax, UpdatePanel and Gridview to achive the following: I like to show a Gridview with Data ONLY if the user is interested in Details, but without a full page...
4
by: Luqman | last post by:
I have populated the Child Accounts and Parent Accounts in a Grid View Control, I want to hide the Select Column of Parent Accounts, but not the Child Accounts, is it possible ? I am using VS...
3
by: mudassir368 | last post by:
--This is the html code <body> <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"> <Columns>...
0
by: gnewsgroup | last post by:
Well, I am trying to use the footer row of a GridView for insertion purpose. There are some articles about this, for example, the gridviewguy.com has an example, which always displays the footer...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.