I get this error whereas I have checked all the code. Can someone points out where I am wrong?
--------------------------------------
Line 29: If e.CommandName = "New" Then
Line 30: Code.Direction = Data.ParameterDirection.Input
Line 31: Code.Value = (DirectCast(GridView1.Controls(0).Controls(0).FindControl("txtCode"), TextBox)).Text
Line 32:
Line 33: Name.Direction = Data.ParameterDirection.Input

-----------------------------------

Recommended Answers

All 2 Replies

u should give full method body
while a quick guess


GridView1.Controls(0).Controls(0).FindControl("txtCode")
u should compare with it null

Before taking value just check whether that particular control is not null :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.