![]() |
|
|
|
#1 |
|
Hi there,
I'm trying to make a basic app in asp.net written in C#. I managed to get it working in a appliaction, but when i make inside an webapplication, it wont work. Any ideas? private void Nameserver_SignedIn(object sender, EventArgs e) { UpdateContactListDelegate updateListBox = new UpdateContactListDelegate(this.UpdateContactList); --> ListBox1.Invoke(updateListBox); } public delegate void UpdateContactListDelegate(); private void UpdateContactList() { ListBox1.Items.Clear(); System.Windows.Forms.MessageBox.Show("D"); foreach (Contact contact in msn.ContactList.All) { this.ListBox1.Items.Add("C: " + contact.Name); } } The problem occures at "ListBox1.Invoke(updateListBox);". I have to invoke it couse it goed cross threading. The error i get is "System.Web.UI.WebControls.ListBox' does not contain a definition for 'Invoke" Oitne.Inside@gmail.com |
|
|
|
|
#2 |
|
Posts: n/a
|
That's correct. You're thinking web controls behave like Windows Forms
controls, and they do not. A web page is stateless, and the entire Page class is gone once the page has been sent to the browser. Events in ASP.NET are handled via the postback mechanism. You can get a lot of very helpful info at the asp.net site. Look for "QUICKSTART". -Peter Recursion: see Recursion site: http://www.eggheadcafe.com unBlog: http://petesbloggerama.blogspot.com BlogMetaFinder: http://www.blogmetafinder.com "" wrote: > Hi there, > > I'm trying to make a basic app in asp.net written in C#. I managed to > get it working in a appliaction, but when i make inside an > webapplication, it wont work. Any ideas? > > private void Nameserver_SignedIn(object sender, EventArgs e) > { > UpdateContactListDelegate updateListBox = new > UpdateContactListDelegate(this.UpdateContactList); > --> ListBox1.Invoke(updateListBox); > } > > public delegate void UpdateContactListDelegate(); > private void UpdateContactList() > { > ListBox1.Items.Clear(); > System.Windows.Forms.MessageBox.Show("D"); > foreach (Contact contact in msn.ContactList.All) > { > this.ListBox1.Items.Add("C: " + contact.Name); > } > > } > > The problem occures at "ListBox1.Invoke(updateListBox);". I have to > invoke it couse it goed cross threading. The error i get is > "System.Web.UI.WebControls.ListBox' does not contain a definition for > 'Invoke" > > =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?= |
|
|
|
#3 |
|
Posts: n/a
|
That's correct. An ASP.Net application is not single-threaded, so you can
simply call the method. -- HTH, Kevin Spencer Microsoft MVP DSI PrintManager, Miradyne Component Libraries: http://www.miradyne.net <> wrote in message news: ups.com... > Hi there, > > I'm trying to make a basic app in asp.net written in C#. I managed to > get it working in a appliaction, but when i make inside an > webapplication, it wont work. Any ideas? > > private void Nameserver_SignedIn(object sender, EventArgs e) > { > UpdateContactListDelegate updateListBox = new > UpdateContactListDelegate(this.UpdateContactList); > --> ListBox1.Invoke(updateListBox); > } > > public delegate void UpdateContactListDelegate(); > private void UpdateContactList() > { > ListBox1.Items.Clear(); > System.Windows.Forms.MessageBox.Show("D"); > foreach (Contact contact in msn.ContactList.All) > { > this.ListBox1.Items.Add("C: " + contact.Name); > } > > } > > The problem occures at "ListBox1.Invoke(updateListBox);". I have to > invoke it couse it goed cross threading. The error i get is > "System.Web.UI.WebControls.ListBox' does not contain a definition for > 'Invoke" > Kevin Spencer |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| URGENT Help needed with ASP.NET Compilation error | nunu_bug | General Help Related Topics | 0 | 08-06-2009 01:26 PM |
| viewstate MAC failed in asp.net 2.0 while postback the page | azraffarveen | Software | 0 | 05-12-2009 03:24 PM |
| .NET 2.0 Web Apps / .NET 3.5 ASP.NET Apps - Differences/Similariti | london1919 | MCTS | 1 | 12-08-2008 03:16 PM |
| ASP.NET: Asign Users in Roles(Array.IndexOf(Of String) method) | msandlana | Software | 0 | 04-25-2008 06:37 AM |
| ASP.NET 2.0 application does not run in WIN2k3 | johnfraj | Software | 0 | 04-19-2007 08:27 AM |