Exemple #1
0
        /// <summary>
        /// ���û��Ķ�Ѷ��¼��ʾ��datagrid��
        /// </summary>
        protected void BindGrid(string Username,string DispType)
        {
            SMS sm = new SMS();
            SqlDataReader dr = null;
            if(DispType=="1") //�ҵ����Ľ���
            {
                try
                {
                    dr = sm.GetMyReceive(Username);
                    dgMsgList.DataSource = UDS.Components.Tools.ConvertDataReaderToDataTable(dr).DefaultView;
                    dgMsgList.DataBind();
                }
                catch
                {
                    Server.Transfer("../Error.aspx");
                }
            }

            if(DispType=="2") //��������
            {
                try
                {
                    dr = sm.GetMySent(Username);
                    dgMsgList.DataSource = UDS.Components.Tools.ConvertDataReaderToDataTable(dr).DefaultView;
                    dgMsgList.DataBind();
                }
                catch
                {
                    Server.Transfer("../Error.aspx");
                }

            }

            switch (DispType)
            {
                case "1":
                    dgMsgList.Columns[2].Visible = false; //�������ռ���
                    break;
                case "2":
                    dgMsgList.Columns[1].Visible = false; //�������ռ���
                    this.btnRead .Visible = false;         //�������İ�ť
                    this.btnDelete .Visible = false;       //����ɾ����ť
                    break;
                default:
                    break;
            }

            sm = null;
            dr = null;
        }