protected void SetUserDropDown()
        {
            UserDa  das = new UserDa();
            DataSet ds  = das.GetUsers();

            SelectUserName.DataSource     = ds.Tables[0].DefaultView;
            SelectUserName.DataValueField = "UserId";
            SelectUserName.DataTextField  = "UserFullName";
            SelectUserName.DataBind();
            SelectUserName.Items.Insert(0, new ListItem(""));
        }
Example #2
0
        override protected void Page_Load(object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);

            valMsg.Text       = "";
            groupMessage.Text = "";
            AddBtn.ImageUrl   = "../Images/AdminImages/submit.gif";
            AddBtn.Width      = 65;
            AddBtn.Height     = 21;

            SelectUserName.Attributes.Add("onchange", "this.form." + SelectSubmitted.ClientID + ".value = 'true'; this.form.submit();");

            if (Page.IsPostBack)
            {
                //check if form is submitted from select box or to update password
                if (!Request.Form["SelectUserName"].Equals("") && Request.Form["SelectSubmitted"] != null && Request.Form["SelectSubmitted"].Equals("true"))
                {
                    this.ShowGroupSelect(int.Parse(Request.Form["SelectUserName"]));
                }
            }
            else
            {
                // Put user code to initialize the page here
                //don't use AdminUtil function because need username here
                UserDa  das = new UserDa();
                DataSet ds  = das.GetUsers();
                SelectUserName.DataSource     = ds.Tables[0].DefaultView;
                SelectUserName.DataValueField = "UserId";
                SelectUserName.DataTextField  = "UserFullName";
                SelectUserName.DataBind();
                SelectUserName.Items.Insert(0, new ListItem(""));

                SelectGroupTable.Visible = false;

                //adding new user
                if (Request.QueryString["newUser"] != null && Request.QueryString["newUser"].Equals("yes"))
                {
                    SelectUserName.Value = Request.QueryString["userId"];

                    this.ShowGroupSelect(int.Parse(Request.QueryString["userId"]));
                }
            }
        }        //end page_load