Drop Down List is empty on page_load

N

news.sbcglobal.net

Can anyone tell me how to fix this so that my drop down list is not empty
when the page loads (ASP.NET 2.0). Thanks!:

------------------------------
HTML
-----------------------------
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true"
CodeFile="UserManager.aspx.vb" Inherits="Admin_UserManager" Title="User
Manager" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<h2>
User Manager</h2>
Roles:
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Get Users In Role"
OnClick="Button1_Click" />
<p>
<asp:GridView ID="GridView1" runat="server" />
</p>
</asp:Content>

------------------------------------
CODE
-----------------------------------

Partial Class Admin_UserManager
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
DropDownDataBind()
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
GridView1.DataSource =
Roles.GetUsersInRole(DropDownList1.SelectedValue)
GridView1.DataBind()
DropDownDataBind()
End Sub

Protected Sub DropDownDataBind()
DropDownList1.DataSource = Roles.GetAllRoles()
End Sub

End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top