本文介绍了如何找到列表视图控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨我必须在单击按钮时编辑列表视图,然后再进行更新.
我的代码生成一个错误....对象引用未设置为对象的实例."
我的代码如下.....
收合|复制代码
受保护的 Sub btnedit_Click( ByVal 发件人 As 对象, ByVal e As System.EventArgs) Handles btnedit.Click Dim currentID As 整数 Dim dblAmount1 As 整数 Dim dblAmount2 As 整数 Dim myAdapter As spGetFeeStructureTableAdapter 对于 每个项目 As ListViewDataItem 位于 lvFeeStructure.Items中 currentID = lvFeeStructure.DataKeys(item.DataItemIndex).Value intGradeID = CType (ddlGrades.SelectedValue,整数) 如果(item.ItemType = ListViewItemType.DataItem)然后 dblAmount1 = Val( CType (item.FindControl " decMonth1TextBox" ),TextBox).Text) dblAmount2 = Val( CType (item.FindControl(" decMonth2TextBox "),TextBox).Text) myAdapter.UpdateFeeStructure(" CurrentID" ,intGradeID,dblAmount1,dblAmount2) lvFeeStructure.DataBind() 结束 子
请帮帮我.
谢谢
Pooja Thakur
解决方案
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.....
Collapse | Copy Code
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.
Thank You
Pooja Thakur
解决方案
这篇关于如何找到列表视图控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!