Example #1
0
        protected void dataList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //DataRow row = ((DataRowView)e.Item.DataItem).Row;    //<-- DataSet에서만 가능
                System.Data.Common.DbDataRecord dRecord = (System.Data.Common.DbDataRecord)e.Item.DataItem;
                //((Literal)e.Item.FindControl("litIDX")).Text = e.Item.ItemIndex.ToString();

                //회원등급
                Label mLevel = (Label)e.Item.FindControl("mLevel");
                mLevel.ToolTip = MbrBaseLib.Self.GetStatusText(dRecord.GetByte(dRecord.GetOrdinal("mLevel")));


                //회사명(직업)
                Label lbJobInfo = (Label)e.Item.FindControl("lbJobInfo");
                lbJobInfo.Text    = dRecord.GetValue(dRecord.GetOrdinal("company")).ToString();
                lbJobInfo.ToolTip = dRecord.GetValue(dRecord.GetOrdinal("jobType")).ToString();

                //최근로그인한 날
                Label hobbies = (Label)e.Item.FindControl("hobbies");
                hobbies.ToolTip = dRecord.GetValue(dRecord.GetOrdinal("hobbies")).ToString();
                if (hobbies.ToolTip != "")
                {
                    hobbies.Text = Text.ShortenString(hobbies.ToolTip, 10);
                }

                //메일링크
                HyperLink hlEmail = (HyperLink)e.Item.FindControl("hlEmail");
                hlEmail.Text    = string.Format("{0} ({1})", dRecord.GetString(dRecord.GetOrdinal("MbrName")), dRecord.GetString(dRecord.GetOrdinal("loginID")));
                hlEmail.ToolTip = dRecord.GetValue(dRecord.GetOrdinal("MbrEmail")).ToString();
                string strSendonemail = Text.GetEmailFormat(dRecord.GetValue(dRecord.GetOrdinal("MbrName")).ToString(), hlEmail.ToolTip);
                hlEmail.NavigateUrl = "../Mine/Mail/MailForm.aspx?m=" + strSendonemail;

                //월급정보
                Literal litMonthlyPayText = (Literal)e.Item.FindControl("litMonthlyPayText");
                litMonthlyPayText.Text = MbrBaseLib.Self.GetMonthlyPayText(dRecord.GetValue(dRecord.GetOrdinal("monthlyPay")).ToString());

                //자동차정보
                Literal litCarInfoText = (Literal)e.Item.FindControl("litCarInfoText");
                litCarInfoText.Text = MbrBaseLib.Self.GetCarInfoText(dRecord.GetValue(dRecord.GetOrdinal("carInfo")).ToString());


                URLQuery.Self["mbID"] = ((System.Data.Common.DbDataRecord)e.Item.DataItem).GetValue(0).ToString();
                bool boolDisplay;
                if (MbrBaseLib.Self.CanAccess(string.Empty))
                {
                    //보기버튼
                    HyperLink hlView = (HyperLink)e.Item.FindControl("hlView");
                    hlView.NavigateUrl = "MbrView.aspx?" + URLQuery.Self.GetQueryString();
                    hlView.ToolTip     = "내용보기";
                    hlView.Visible     = true;
                    //수정버튼
                    ImageButton ibModfy = (ImageButton)e.Item.FindControl("ibModfy");
                    ibModfy.CommandName     = "select";
                    ibModfy.CommandArgument = dataList.DataKeys[e.Item.ItemIndex].ToString();
                    //이렇게 할필요 까지???ibModfy.Attributes["onClick"] = "return ConfirmJ('수정하시겠습니까?');";
                    ibModfy.ToolTip = "수정하기";
                    ibModfy.Visible = true;

                    //Response.Write(hlView.Visible + " - " + ibModfy.Visible + " : " + DateTime.Now.ToString() + "<br>");
                    boolDisplay = false;
                }
                else
                {
                    boolDisplay = true;
                }
                //없음표시(뭔가 이상);
                Literal displayNone = (Literal)e.Item.FindControl("displayNone");
                displayNone.Visible = boolDisplay;//DisplayNone(hlView.Visible, ibModfy.Visible);
            }
            else if (e.Item.ItemType == ListItemType.Header)
            {
                Literal litSearchResult = (Literal)e.Item.FindControl("litSearchResult");
                Literal litListBrief    = (Literal)e.Item.FindControl("litListBrief");

                litSearchResult.Text = this.SearchResultDisplay(this.tbSearchString.Text);
                litListBrief.Text    = Paging.Self.ListSummary;
                //각종 상태값 메모리로 올림(상태유지를 위해)
                SetQueryString();
                #region 페이징기능구현
                Paging.Self.Init_Violet();
                this.litPaging.Text = Paging.Self.GeneratePaging();
                #endregion
            }
            else if (e.Item.ItemType == ListItemType.Footer)
            {
                //페이징기능이 여기에 구현되어야 하나 인터페이스에 없으므로 헤더에서 구현
                //Literal litPaging = (Literal)e.Item.FindControl("litPaging");
            }
        }