Finding a GridView in FormView

M

MRW

For some strange reason, I'm having problems finding a GridView in a
FormView. I keep getting the error:

Object reference not set to an instance of an object.

I have the code below, it's very simple, yet I can't 'grab' my
gridview. Can anybody help me out on this?


----

Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs)
FV.ChangeMode(FormViewMode.Edit)
If FV.CurrentMode = FormViewMode.Edit Then
Dim GV1 As GridView = FV.FindControl("GV")
GV1.Enabled = False <----Error occurs here
End If
End Sub

---

<asp:FormView ID="FV" runat="server">
<EditItemTemplate> <asp:GridView ID="GV"
AutoGenerateColumns=true
runat=server></asp:GridView></EditItemTemplate>
</asp:FormView>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top