Click here to Skip to main content
16,016,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
I've to edit listview on button click and then update too.
my code generating an error...."Object reference not set to an instance of an object."
my code is as follows.....

VB
Protected Sub btnedit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnedit.Click
Dim currentID As Integer
        Dim dblAmount1 As Integer
        Dim dblAmount2 As Integer
  Dim myAdapter As spGetFeeStructureTableAdapter
For Each item As ListViewDataItem In lvFeeStructure.Items
           currentID = lvFeeStructure.DataKeys(item.DataItemIndex).Value
           intGradeID = CType(ddlGrades.SelectedValue, Integer)
           If (item.ItemType = ListViewItemType.DataItem) Then
           dblAmount1 = Val(CType(item.FindControl "decMonth1TextBox"), TextBox).Text)
                dblAmount2 = Val(CType(item.FindControl("decMonth2TextBox "), TextBox).Text)
myAdapter.UpdateFeeStructure("CurrentID", intGradeID,dblAmount1 ,dblAmount2)
lvFeeStructure.DataBind()

End Sub


Please help me out.

How to find ListView Control without using listView control??

Thank You
Pooja Thakur
Posted
Updated 25-Aug-11 1:18am
v2
Comments
Herman<T>.Instance 25-Aug-11 7:19am    
strange question 'How to find ListView Control without using listView control??'
Syed Salman Raza Zaidi 25-Aug-11 7:40am    
If some thing is not present physically/or its not been initialized then how can you find it?

How can u find without using list view Object.
 
Share this answer
 
This error occurs when you are trying access a member of an object that is null.
Try debugging through the code to see which control is throwing this error.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900