Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Help me! I can't get ListBox work for me!


Message #1 by "funnyfan" <fanjunhan@y...> on Thu, 15 Nov 2001 05:18:29
Are you creating an event handler similar to
this.user.SelectedIndexChanged 
	+= new System.EventHandler(this.userToManager_Click);
?

Lou
  

-----Original Message-----
From: funnyfan [mailto:fanjunhan@y...] 
Sent: Thursday, November 15, 2001 5:18 AM
To: ASPX_Professional
Subject: [aspx_professional] Help me! I can't get ListBox work for me!


I can't get ListBox.SelectedItem.Text because the ListBox.SelectedIndex 
always equal -1. It is useless that i click ListBox's item.
my code like this:

protected System.Web.UI.WebControls.ListBox user;
protected System.Web.UI.WebControls.ListBox manager;
protected System.Web.UI.WebControls.Button userToManager;

private void Page_Load(object sender, System.EventArgs e)
		{
			ArrayList  userList = users.getUser(0);
			user.DataSource = userList;
			user.DataBind();
			ArrayList  adminList=users.getUser(1);
			admin.DataSource = adminList;
			admin.DataBind();
		}
private void userToManager_Click(object sender, System.EventArgs e)
		{
			if (user.SelectedIndex > -1)
			users.UpdateLevel(user.SelectedItem.Text,2);
		}


---
VBug Winter Conference 2001 

Make no mistake - there's a great learning curve 
for developers moving from COM to .NET.  So why 
would you want to be a pioneer and cross the bridges 
first?  Attend the .NET Developer's Conference 
(28th to 30th November 2001) In London and realise 
the benefits of adopting the technology early.  By 
attending you'll understand the key challenges and 
be left with a thorough understanding of the major 
.NET fundamentals.   If you're already working 
with .NET this is a must-attend event.  

http://www.vbug.co.uk/redirect.asp?url=39&id=17

---
You are currently subscribed to 
aspx_professional as: lklauder@w...
$subst('Email.Unsub')


  Return to Index