예제 #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // �ڴ˴������û������Գ�ʼ��ҳ��

            if(!Page.IsPostBack)
            {
                string staffids = "";
                boardid = (Request.QueryString["BoardID"]==null)?0:Convert.ToInt32(Request.QueryString["BoardID"]);
                classid = (Request.QueryString["classID"]==null)?0:Int32.Parse(Request.QueryString["classID"]);

                ViewState["boardid"] = boardid;
                ViewState["classid"] = classid;

                UDS.Components.Staff staff = new UDS.Components.Staff();
                BBSClass bbs = new BBSClass();
                SqlDataReader dr = null;
                SqlDataReader dr1 = null;
                DataTable dt = new DataTable();
                try
                {
                    dr = bbs.GetBoardMember();
                    dt = Tools.ConvertDataReaderToDataTable(dr);
                    dt.DefaultView.RowFilter = "board_id=" + boardid;
                    lbBoardMemberList.DataSource = dt.DefaultView;
                    lbBoardMemberList.DataValueField = "staff_id";
                    lbBoardMemberList.DataTextField = "realname";
                    lbBoardMemberList.DataBind();
                    for (int i = 0; i < lbBoardMemberList.Items.Count; i++)
                    {
                        staffids += lbBoardMemberList.Items[i].Value + ",";
                    }
                    if (staffids.Length != 0)
                        staffids = staffids.Substring(0, staffids.Length - 1);
                    dr1 = staff.GetRemainStaff(staffids);
                    lbRemainStaffsList.DataSource = dr1;
                    lbRemainStaffsList.DataValueField = "staff_id";
                    lbRemainStaffsList.DataTextField = "realname";
                    lbRemainStaffsList.DataBind();
                    dr1.Close();
                }
                catch (Exception ex)
                {
                    UDS.Components.Error.Log(ex.ToString());
                    Server.Transfer("../../Error.aspx");
                }
                finally
                {
                    if (dr1 != null)
                    { dr1.Close(); }
                    if (dr != null)
                    {

                        dr.Close();
                    }
                }

            }
            else
            {
                classid = Int32.Parse(ViewState["classid"].ToString());
                boardid = Int32.Parse(ViewState["boardid"].ToString());
            }
            HyperLink1.DataBind();
        }