private void RenderHeader(HtmlTextWriter writer)
        {
            //render Header row
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            if (HeaderStyle != null)
            {
                HeaderStyle.AddAttributesToRender(writer);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(Localization.GetString(ID + "_Available", LocalResourceFile));
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.RenderEndTag();
            if (HeaderStyle != null)
            {
                HeaderStyle.AddAttributesToRender(writer);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(Localization.GetString(ID + "_Selected", LocalResourceFile));
            writer.RenderEndTag();

            //Render end of Header Row
            writer.RenderEndTag();
        }
示例#2
0
//-------------------------------------------------------------------------------------------
        protected void RenderContents(HtmlTextWriter output)
        {
            Page.ClientScript.RegisterHiddenField(this.UniqueID + "_RowDoubleClicked", "-1");
            TableItemStyle style = this.ItemStyle;

            if (HasControls())
            {
                foreach (DataGridItem row in Controls[0].Controls)
                {
                    bool itemrow = false;
                    switch (row.ItemType)
                    {
                    case ListItemType.Header:
                        HeaderStyle.AddAttributesToRender(output);
                        break;

                    case ListItemType.Footer:
                        FooterStyle.AddAttributesToRender(output);
                        break;

                    case ListItemType.Pager:
                        if (PagerStyle.Position == PagerPosition.Top && Controls[0].Controls.IndexOf(row) > 2)
                        {
                            continue;
                        }
                        if (PagerStyle.Position == PagerPosition.Bottom && Controls[0].Controls.IndexOf(row) < 2)
                        {
                            continue;
                        }
                        this.PagerStyle.ForeColor = this.PagerStyle.ForeColor;
                        this.PagerStyle.AddAttributesToRender(output);
                        break;

                    case ListItemType.EditItem:
                        itemrow = true;
                        this.EditItemStyle.AddAttributesToRender(output);
                        break;

                    case ListItemType.SelectedItem:
                        itemrow = true;
                        this.SelectedItemStyle.AddAttributesToRender(output);
                        break;

                    default:

                        break;
                    }
                    if (itemrow)
                    {
                        //output.AddAttribute("onclick", "CheckBoxForRow(this, '" + ColorTranslator.ToHtml(HighlightColor) + "')");
                    }
                    if (row.Visible)
                    {
                        //row.RenderControl(output);
                        row.RenderBeginTag(output);
                        for (int i = 0; i < row.Controls.Count; i++)
                        {
                            TableCell cell = (TableCell)row.Controls[i];
                            if (Columns[i].Visible && cell.Visible)
                            {
                                switch (row.ItemType)
                                {
                                case ListItemType.Header:
                                    break;

                                case ListItemType.Item:
                                    Columns[i].ItemStyle.AddAttributesToRender(output);
                                    break;

                                case ListItemType.AlternatingItem:
                                    Columns[i].ItemStyle.AddAttributesToRender(output);
                                    break;

                                case ListItemType.EditItem:
                                    //Columns[i].AddAttributesToRender(output);
                                    break;

                                case ListItemType.Footer:
                                    break;
                                }
                                cell.RenderControl(output);

                                //if (row.ItemType == ListItemType.Item ||
                                //     row.ItemType == ListItemType.AlternatingItem)
                                //     output.RenderEndTag();
                                //RenderControlTree(output, cell, !Columns[i].ItemStyle.Width.IsEmpty);
                            }
                        }
                        row.RenderEndTag(output);
                    }
                }
            }
        }