当前位置: 首页>>代码示例>>C#>>正文


C# TableCell.MergeStyle方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.TableCell.MergeStyle方法的典型用法代码示例。如果您正苦于以下问题:C# TableCell.MergeStyle方法的具体用法?C# TableCell.MergeStyle怎么用?C# TableCell.MergeStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.TableCell的用法示例。


在下文中一共展示了TableCell.MergeStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCallbackResult

        public string GetCallbackResult()
        {
            //return string.Empty;
            ThemeHelper theme = new ThemeHelper(Theme);
            if (!Enabled)
            {
                return string.Empty;
            }

            mv.Width = DateBoxWidth;
            mv.BorderStyle = BorderStyle.None;
            mv.ShowTitle = false;
            mv.DayRender += MonthViewDayRender;

            mv.Font.Name = "Tahoma";
            mv.DayStyle.MergeWith(theme.DayStyle);
            mv.DayHeaderStyle.MergeWith(theme.DayStyle);
            mv.SelectedDayStyle.MergeWith(theme.SelectedDayStyle);
            mv.TodayDayStyle.MergeWith(theme.TodayDayStyle);

            //next & prev formats

            DropDownList list = theme.CreateFooterDropDownList();
            //list.MergeStyle(monthYearDropDownStyle);

            StringBuilder sb = new StringBuilder();
            StringWriter writer = new StringWriter(sb);
            HtmlTextWriter tw = new HtmlTextWriter(writer);

            if (this.EnableDropShadow)
            {
                tw.AddStyleAttribute(HtmlTextWriterStyle.Display, "#EFEFEF");
            }
            tw.AddAttribute(HtmlTextWriterAttribute.Id, "FADatePickerDropShadow_" + this.ClientID);
            tw.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, (this.ZIndex + 1).ToString());
            tw.AddStyleAttribute(HtmlTextWriterStyle.Left, this.CalendarOffsetX.ToString());
            tw.AddStyleAttribute(HtmlTextWriterStyle.Top, this.CalendarOffsetY.ToString());
            tw.AddStyleAttribute(HtmlTextWriterStyle.Position, "absolute");
            tw.AddStyleAttribute(HtmlTextWriterStyle.Display, "inline");
            tw.AddStyleAttribute("min-width", this.mv.Width.ToString());
            tw.AddAttribute("CellPadding", "0");
            tw.AddAttribute("CellSpacing", "0");
            tw.RenderBeginTag(HtmlTextWriterTag.Table);
            tw.RenderBeginTag(HtmlTextWriterTag.Tr);
            tw.RenderBeginTag(HtmlTextWriterTag.Td);
            tw.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "white");
            tw.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, "gray");
            tw.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid");
            tw.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "1px");
            tw.AddStyleAttribute(HtmlTextWriterStyle.Left, "-4px");
            tw.AddStyleAttribute(HtmlTextWriterStyle.Top, "-4px");
            tw.AddStyleAttribute(HtmlTextWriterStyle.Width, this.mv.Width.ToString());
            tw.AddAttribute(HtmlTextWriterAttribute.Id, "FADatePickerCalendarContainer_" + this.ClientID);
            tw.AddAttribute("CellPadding", "0");
            tw.AddAttribute("CellSpacing", "0");
            tw.RenderBeginTag(HtmlTextWriterTag.Table);
            tw.RenderBeginTag(HtmlTextWriterTag.Tr);
            tw.RenderBeginTag(HtmlTextWriterTag.Td);

            Table table = theme.CreateTitleTable(this.Page);
            table.Width = Unit.Percentage(100.0);
            table.MergeStyle(this.MonthViewTitleStyle);
            table.ID = "FADatePickerCalendarTitle_" + this.ClientID;
            table.RenderBeginTag(tw);
            tw.RenderBeginTag(HtmlTextWriterTag.Tr);
            TableCell cell = new TableCell();
            cell.Style.Add(HtmlTextWriterStyle.TextAlign, "left");
            cell.MergeStyle(this.MonthViewNextPrevStyle);
            cell.RenderBeginTag(tw);

            if ((this.mv.VisibleDate.Month > this.MinDate.Month) || (this.mv.VisibleDate.Year > this.MinDate.Year))
            {
                try
                {
                    DateTime dt = this.mv.VisibleDate.AddMonths(-1);
                    dt = dt.AddDays((double)-(dt.Day - 1));
                    if (this.NextPrevFormat == NextPrevFormat.ShortMonth)
                    {
                        tw.WriteLine("<div style='cursor:pointer;' onclick=\"javascript:CallServer_" + this.ClientID + "('" + dt.ToShortDateString() + "')\">" + dt.ToString("MMM") + "</div>");
                    }
                    else if (this.NextPrevFormat == NextPrevFormat.FullMonth)
                    {
                        tw.WriteLine("<div style='cursor:pointer;' onclick=\"javascript:CallServer_" + this.ClientID + "('" + dt.ToShortDateString() + "')\">" + dt.ToString("MMMM") + "</div>");
                    }
                    else
                    {
                        tw.WriteLine("<div style='cursor:pointer;' onclick=\"javascript:CallServer_" + this.ClientID + "('" + dt.ToShortDateString() + "')\">" + this.PrevMonthText + "</div>");
                    }
                }
                catch
                {
                }
            }

            cell.RenderEndTag(tw);
            tw.AddStyleAttribute(HtmlTextWriterStyle.TextAlign, "center");
            tw.RenderBeginTag(HtmlTextWriterTag.Td);
            tw.WriteLine(this.mv.VisibleDate.ToString("MMMM yyyy"));
            tw.RenderEndTag();
            TableCell cell2 = new TableCell();
//.........这里部分代码省略.........
开发者ID:Jalalx,项目名称:FarsiLibrary,代码行数:101,代码来源:FADatePicker.cs

示例2: BuildHeader

        protected GridViewRow BuildHeader()
        {
            GridViewRow tr = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);

            TableCell thTL = new TableCell();
            thTL.Style.Add(HtmlTextWriterStyle.Width, "6px");
            thTL.CssClass = "GridViewHeaderTL";
            tr.Cells.Add(thTL);

            for (int i = 0; i < this.Columns.Count; i++)
            {
                TableCell th = new TableCell();
                th.CssClass = "GridViewHeaderTC";

                if (this.Columns[i] is SortableField && ((this.Columns[i] as SortableField).ShowSort))
                {
                    ImageButton imgSort = new ImageButton();
                    imgSort.ID = "imgSort_" + i.ToString();
                    imgSort.CssClass = "GridViewHeaderSort";
                    imgSort.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(RainstormStudios.Web.UI.WebControls.GridView), "RainstormStudios.Web.UI.WebControls.images.gridView.Sort.png");
                    imgSort.AlternateText = "";
                    imgSort.CommandArgument = (this.Columns[i] as BoundField).DataField;
                    imgSort.CommandName = "Sort";
                    imgSort.Command += new CommandEventHandler(this.imgSort_OnCommand);
                    th.Controls.Add(imgSort);
                    imgSort.Attributes.Add("name", imgSort.UniqueID);
                }

                bool usedTemplate = false;
                if (this.Columns[i] is System.Web.UI.WebControls.TemplateField)
                {
                    TemplateField fld = (this.Columns[i] as TemplateField);
                    ITemplate hdrTmpl = fld.HeaderTemplate;
                    if (hdrTmpl != null)
                    {
                        hdrTmpl.InstantiateIn(th);
                        usedTemplate = true;
                    }
                }

                if (!usedTemplate)
                {
                    // Standard field
                    Label lblHdr = new Label();
                    lblHdr.Text = this.Columns[i].HeaderText;
                    th.Controls.Add(lblHdr);
                }

                th.MergeStyle(this.Columns[i].HeaderStyle);
                tr.Cells.Add(th);
            }

            TableCell thTR = new TableCell();
            thTR.Style.Add(HtmlTextWriterStyle.Width, "6px");
            thTR.CssClass = "GridViewHeaderTR";
            tr.Cells.Add(thTR);

            this._hdrRow = tr;
            this.OnItemCreated(new GridViewItemEventArgs(tr));
            return tr;
        }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:61,代码来源:GridView.cs

示例3: ApplySortingStyle

 private void ApplySortingStyle(TableCell cell, DataControlField field, TableItemStyle ascendingStyle, TableItemStyle descendingStyle) {
     if (!String.IsNullOrEmpty(SortExpression) && String.Equals(field.SortExpression, SortExpression, StringComparison.OrdinalIgnoreCase)) {
         if (SortDirection == SortDirection.Ascending) {
             cell.MergeStyle(ascendingStyle);
         }
         else {
             cell.MergeStyle(descendingStyle);
         }
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:10,代码来源:GridView.cs

示例4: CreateControlHeirarchy

        protected int CreateControlHeirarchy(IEnumerable dataSource, bool useDataSource)
        {
            // Clear/create the rows ArrayList
            if (this._rows == null)
                this._rows = new ArrayList();
            else
                this._rows.Clear();

            GridViewRow hdr = this.BuildHeader();

            if (this.PageIndex < 0)
                this.PageIndex = 0;
            //int startRec = this.PageIndex * this.PageSize;
            int itemCount = 0; //, recCount = 0;
            if (dataSource != null)
            {
                foreach (var dataItem in dataSource)
                {
                    //if (recCount < startRec || itemCount >= this.PageSize)
                    //{
                    //    recCount++;
                    //    continue;
                    //}

                    GridViewRow tr = new GridViewRow(itemCount + (this.ShowHeader ? 1 : 0), itemCount, DataControlRowType.DataRow, (itemCount % 2 == 0 ? DataControlRowState.Normal : DataControlRowState.Alternate));
                    tr.CssClass = (itemCount % 2 == 0) ? "GridViewLineAlt" : "GridViewLine";

                    TableCell tdL = new TableCell();
                    tdL.CssClass = "GridViewLineLeft";
                    tr.Cells.Add(tdL);

                    int curColCount = 0;
                    for (int i = 0; i < this.Columns.Count; i++)
                    {
                        TableCell td = new TableCell();

                        DataControlField column = this.Columns[i];

                        bool usedTemplate = false;
                        if (column is TemplateField)
                        {
                            TemplateField fld = (column as TemplateField);
                            ITemplate template = null;
                            if (itemCount % 2 != 0)
                                template = fld.AlternatingItemTemplate;
                            if (template == null)
                                template = fld.ItemTemplate;

                            if (template != null)
                            {
                                template.InstantiateIn(td);
                                usedTemplate = true;
                            }
                        }

                        if (!usedTemplate)
                        {
                            string dataStr = string.Empty;
                            if (column is BoundField)
                            {
                                BoundField fld = (column as BoundField);
                                if (!string.IsNullOrEmpty(fld.DataField))
                                    dataStr = DataBinder.GetPropertyValue(dataItem, fld.DataField, fld.DataFormatString);
                                else
                                {
                                    PropertyDescriptorCollection props = TypeDescriptor.GetProperties(dataItem);
                                    if (props.Count >= 1)
                                        if (null != props[0].GetValue(dataItem))
                                            dataStr = props[0].GetValue(dataItem).ToString();
                                }
                            }

                            if (column is CheckBoxField)
                            {
                                CheckBoxField fld = (column as CheckBoxField);
                                CheckBox chkFld = new CheckBox();
                                chkFld.ID = string.Format("chkField_{0}_{1}", itemCount, i);
                                string fldStr = string.Empty;
                                if (!string.IsNullOrEmpty(fld.Text))
                                    fldStr = fld.Text;
                                else if (!string.IsNullOrEmpty(fld.DataField))
                                    fldStr = dataStr;
                                chkFld.Text = fldStr;
                                chkFld.MergeStyle(fld.ControlStyle);
                                td.Controls.Add(chkFld);
                            }
                            else if (column is CommandField)
                            {
                                CommandField fld = (column as CommandField);

                                string keyArg = string.Empty;
                                if (this.DataKeyNames != null && this.DataKeyNames.Length > 0)
                                    keyArg = string.Join(",", this.DataKeyNames);

                                if (fld.ShowSelectButton)
                                {
                                    WebControl btn = this.GetButton(fld, "Select", keyArg, itemCount, i, fld.SelectText, fld.SelectImageUrl);
                                    td.Controls.Add(btn);
                                }

//.........这里部分代码省略.........
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:101,代码来源:GridView.cs


注:本文中的System.Web.UI.WebControls.TableCell.MergeStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。