在页面显示出对应的年月

/// <summary>
        /// 在页面显示出对应的年月
        /// </summary>
        protected void YearMonthBind(string companyID, int startMonth)
        {
            int myYear = Convert.ToInt32(dropYear.SelectedValue);
            int myMonth = startMonth;

            foreach (DataGridItem i in this.DtGrid.Controls[0].Controls)
            {
                if (i.ItemType == ListItemType.Header)
                {
                    for (int month_i = 1; month_i <= 12; month_i++)
                    {
                        Label myLabel = (Label)i.FindControl("lblMonth" + month_i.ToString());
                        myLabel.Text = myYear.ToString() + "." + myMonth.ToString();

                        myMonth++;
                        if (myMonth > 12)
                        {
                            myMonth = myMonth - 12;
                            myYear += 1;
                        }
                    }
                    break;
                }

            }


        }

private void showMessage(string mess)
        {
            string js = "alert('" + mess + "')";
            ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "showMessage", js, true);
        }

posted on 2008-03-25 13:54  romce  阅读(181)  评论(0编辑  收藏  举报