473,804 Members | 2,986 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling ListView ItemUpdating event when a button outside the control is clicked?

5 New Member
I have a listview control in which I had replaced all the ItemTemplate labels with TextBoxs. I also have a command button on the page, when the button is clicked I am able to retreive the text in all the TextBoxes one by one by running a For..next loop. After reading the textboxes content I want to fire the ItemUpdating event for each row so that I can update all the rows at once.

I have the following code in the button_click event, but it does nothing
Expand|Select|Wrap|Line Numbers
  1.     Dim idcount As ListViewItem
  2.         Dim i As Int32
  3.         Dim ei As New ListViewUpdateEventArgs(i)
  4.         For Each idcount In ListView1.Items
  5.             ei.NewValues("Name") = DirectCast(ListView1.Items.Item(i).FindControl("NameLabel"), TextBox).Text
  6.             i = i + 1
  7.         Next
Is it not possible to update all the records at once through the above approach

I also tried another approach listed below with a light change, but with no results...
Expand|Select|Wrap|Line Numbers
  1.     Dim idcount As ListViewItem
  2.         Dim i As Int32
  3.         Dim ei As New ListViewUpdateEventArgs(i)
  4.         For Each idcount In ListView1.Items
  5.             ListView1_ItemUpdating(i, ei) '<-----
  6.             i = i + 1
  7.         Next
Please help
Jan 15 '09 #1
1 4077
Frinavale
9,735 Recognized Expert Moderator Expert
Why don't you just save the names into a list and create a function, called Update, that accepts the list as a parameter and updates the rows?

The ItemUpdating event is a ListView event. The ListView raises this even when an item is being updated. Your code can handle this event but your code cannot raise it.

It would make more sense just to create a method that does the updating rather than try and raise an event which you are going to handle in a method anyways.
Jan 20 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
21275
by: John Lauwers | last post by:
I know you can edit the first column of the listview control, is there a way to edit the second and/or the other columns? greets John
0
1587
by: Sandra | last post by:
I have a form with a list view control that has the checkboxes property set to true. This provides checkboxes as the first column in the listview. When a listviewitem is checked another form is popped up with an ok and cancel button it - only if the user clicks the ok button this form do I want the item in the listview to be checked. I have overriden the ItemCheck event of the listview and set the e.newvalue to be unchecked when the...
6
2338
by: Richard | last post by:
Hi. I use a ListView to display data in tabular form. Each ListView row corresponds to a data record. The ListView Item of the record is the record key or code. Each SubItem in that row represents a field from the record. I implemented a context menu so the user can "Copy" the cell content to the clipboard with this code:
1
10458
by: Alan | last post by:
Hi All, Is it possible to add other controls to the ListView control in C# windows forms. i.e. I want to add a button column so to speak to the list view. You can do this sort of thing with the datagrid in asp.net, however I think the datagrid in c# is overly complex for what I'm wanting to do, and I'm not even sure it is possible to do it in that. Answers to both Controls would be appreciated.
13
3773
by: Maheshkumar.R | last post by:
hi groups, I have placed an listview control, i want to iterate thru the control and find the clicked event items. listView2.Items.Add(fname.ToString(), i); how i can perform the iteration to find the item clicked...? and its item. thankz-- Mähésh Kumär. R
2
2537
by: Frank Schumacher | last post by:
Hi Folks, I have a problem with the order of events fired by ASP.NET. I found many articles which explaining the lifecycle of a site, but I found none which took the event from a Control on the site into consideration. Here is what I want to do: I have a Button, which starts a new search session. When this session is started, you have several Usercontrols, which can navigate within the search session.
41
4335
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based on some initialization information obtained elsewhere. Basically, I'm going to create my own dynamic toolbar where the toolbarbuttons can change. I'm not using the VB toolbar because of limitations in changing things like backcolor (I can't get...
5
2378
by: Martin Horn | last post by:
Hi all, I want to implement a listview with editable subitems and I assume the easiest way is to overlay a textbox over the item to be edited. With this in mind I have come up with: Using fullrowselect=true in the listview Private Sub ListView1_ItemSelectionChanged(ByVal sender As Object, _
4
10857
by: Pucca | last post by:
How can I tell a mouse right clicks over a listview item that's in a container panel. I only want to display a popup menu if the user right click the mouse over an item on the Listview. I don't not want to display this menu if a node selected on the listview but user right click over the empty space of the panel that contain the listview. The problem here is when I use the Listview's Click Event, I don't have ways to verify if the...
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.