Ejemplo n.º 1
0
        internal override void RenderLabelView(HtmlTextWriter writer, RowCell cell)
        {
            if (cell.Value != null && !string.IsNullOrEmpty(ValueColumn))
            {
                RowCollection row   = Table.Rows;
                string        value = cell.Value.ToString();
                for (int i = 0; i < row.Count; i++)
                {
                    if (!string.IsNullOrEmpty(IdentityColumn) && Table.Rows[i][IdentityColumn].Value != null)
                    {
                        if (Table.Rows[i][IdentityColumn].Value.ToString() != value)
                        {
                            continue;
                        }
                    }
                    else if (row[i].PrimaryKeyUpdateValues != value)
                    {
                        continue;
                    }
                    cell.Value = BuildDisplayText(i, ValueColumn, Table);
                    break;
                }
            }
            if (cell.Value == null)
            {
                cell.Value = string.Empty;
            }

            string s = cell.Value.ToString();

            if (string.IsNullOrEmpty(TreeStructureSeperator) == false && TreeParentId != null)
            {
                string text = string.Empty;
                RenderEntireTreeList(ref text, cell.Value, 0);
                if (string.IsNullOrEmpty(text) == false)
                {
                    s = text + TreeStructureSeperator + s;
                }
            }
            RenderGrid(s, writer, cell);
        }
Ejemplo n.º 2
0
        internal override void RenderLabelView(HtmlTextWriter writer, RowCell cell)
        {
            if (cell.Value != null && !string.IsNullOrEmpty(ValueColumn))
            {
                RowCollection row = Table.Rows;
                string value = cell.Value.ToString();
                for (int i = 0; i < row.Count; i++)
                {
                    if (!string.IsNullOrEmpty(IdentityColumn) && Table.Rows[i][IdentityColumn].Value != null)
                    {
                        if (Table.Rows[i][IdentityColumn].Value.ToString() != value)
                            continue;
                    }
                    else if (row[i].PrimaryKeyUpdateValues != value)
                        continue;
                    cell.Value = BuildDisplayText(i, ValueColumn, Table);
                    break;
                }
            }
            if (cell.Value == null)
                cell.Value = string.Empty;

            string s = cell.Value.ToString();

            if (string.IsNullOrEmpty(TreeStructureSeperator) == false && TreeParentId != null)
            {
                string text = string.Empty;
                RenderEntireTreeList(ref text, cell.Value, 0);
                if (string.IsNullOrEmpty(text) == false)
                    s = text + TreeStructureSeperator + s;
            }
            RenderGrid(s, writer, cell);
        }
Ejemplo n.º 3
0
        internal override void RenderEditView(HtmlTextWriter writer, RowCell cell)
        {
            if (Table.m_GotData == false) // Data need to be recovered if CacheDatasourceStructure is active.
            {
                Table.GetData(true);
            }

            if (Identity || AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false))
            {
                RenderLabelView(writer, cell);
                return;
            }

            if (string.IsNullOrEmpty(ValueColumn))
            {
                throw new GridException(
                          String.Format(Table.m_Grid.GetSystemMessage("SystemMessage_ForeignkeyNoValueColumn"), Title));
            }

            StringBuilder s = new StringBuilder(string.Empty);

            switch (ForeignkeyType)
            {
            case ForeignkeyType.Select:
            case ForeignkeyType.SelectMenu:
            {
                StringBuilder eventScript = new StringBuilder(string.Empty);
                StringBuilder javascript  = new StringBuilder(string.Empty);
                if (AutoPostback || string.IsNullOrEmpty(ConfirmMessage) == false)
                {
                    eventScript = new StringBuilder(" onchange=\"");
                    if (string.IsNullOrEmpty(ConfirmMessage) == false)
                    {
                        eventScript.AppendFormat(" if(wgconfirm('{0}',this,'{1}')) ",
                                                 ConfirmMessage.Replace("'", "\\'"),
                                                 Grid.DialogTitle.Replace("'", "\\'"));
                    }
                    string link = Grid.EnableCallBack && !ForcePostBack
                                              ? Asynchronous.GetCallbackEventReference(Grid,
                                                                                       string.Format(
                                                                                           "ElementPostBack!{0}!{1}",
                                                                                           ColumnId,
                                                                                           cell.Row.PrimaryKeyValues),
                                                                                       false,
                                                                                       string.Empty,
                                                                                       string.Empty)
                                              : Grid.Page.ClientScript.GetPostBackEventReference(Grid,
                                                                                                 string.Format(
                                                                                                     "ElementPostBack!{0}!{1}",
                                                                                                     ColumnId,
                                                                                                     cell.Row.
                                                                                                     PrimaryKeyValues));

                    eventScript.AppendFormat("{0}\"", link);
                }

                StringBuilder onblur = new StringBuilder(" onblur=\"");

                if (Grid.ColumnChangedColour != Color.Empty)
                {
                    onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour));
                }
                onblur.Append("\"");
                javascript.Append(onblur);
                s.AppendFormat("<select {0} class=\"wgeditfield wgselectbox {4}\" id=\"{1}\" name=\"{1}\" {2} {3}>",
                               javascript, cell.CellClientId, eventScript, Attributes, CssClass);
                if (m_Foreignkeytype == ForeignkeyType.SelectMenu && (Grid.Scripts == null || !Grid.Scripts.DisableSelectMenu))
                {
                    if (SelectMenuWidth > 0)
                    {
                        Grid.AddClientScript(writer,
                                             string.Format(
                                                 "$(document).ready(function() {{$('#{0}').selectmenu({{maxHeight: {2},style:'dropdown',width: {1}}});}});",
                                                 cell.CellClientId, SelectMenuWidth, SelectMenuMaxHeight));
                    }
                    else
                    {
                        Grid.AddClientScript(writer,
                                             string.Format(
                                                 "$(document).ready(function() {{$('#{0}').selectmenu({{maxHeight: {1},style:'dropdown'}});}});",
                                                 cell.CellClientId, SelectMenuMaxHeight));
                    }
                }

                if (Table.Rows.Count == 0 && NullText == null)
                {
                    NullText = "No data available.";
                }

                if (NullText != null)
                {
                    s.AppendFormat("<option value=\"{1}\">{0}</option>", NullText, string.Empty);
                }

                //CreateRows(Grid,tree,null,0);

                s.Append(CreateSelectRows(TreeParentId != null, null, 0, cell));
                s.Append("</select>");
            }
            break;

            case ForeignkeyType.Radiobuttons:
                m_IsFormElement = false;
                m_Rowcounter    = RecordsPerRow;
                s.AppendFormat("<table class=\"wgradiobuttons {1}\"><tr><td>{0}</td></tr></table>",
                               CreateRadioButtons((TreeParentId != null), null, 0, cell), CssClass);
                break;
            }

            if (string.IsNullOrEmpty(ToolTipInput) == false)
            {
                s = new StringBuilder(Tooltip.Add(s.ToString(), ToolTipInput));
            }

            EditHtml(s.ToString(), writer, cell);
        }
Ejemplo n.º 4
0
        private void DesignRenderGrid(HtmlTextWriter writer,RowCell cell)
        {
            if (Grid == null)
                return;
            StringBuilder tdStart = new StringBuilder();
            StringBuilder style = new StringBuilder();

            if (CssClass != null)
                tdStart.AppendFormat("<td class=\"wggridcell {0}\" ", CssClass);
            else
                tdStart.Append("<td class=\"wggridcell\"");

            if (cell != null && cell.InternalCellSpan > 0)
                tdStart.AppendFormat(" colspan=\"{0}\"", cell.InternalCellSpan);
            if (Rowspan > 1) tdStart.AppendFormat(" rowspan=\"{0}\"", Rowspan);

            if( cell != null )
                tdStart.AppendFormat(" id=\"{0}{1}r{2}\"", Grid.ID, ColumnId, cell.Row.RowIndex);
            else
                tdStart.AppendFormat(" id=\"{0}{1}\"", Grid.ID, ColumnId);

            if (GridAlign != HorizontalPosition.Undefined)
                style.AppendFormat("text-align :{0};", GridAlign);
            else if (Grid.RecordsPerRow > 1) // GUESSING IT IS A PRODUCTLIST OR SOMETHING SIMILAR..
                style.Append("width: 100%;text-align : center;vertical-align:top");

            if (style.Length > 1)
                tdStart.AppendFormat(" style=\"{0}\"", style);

            if (GridVAlign != VerticalPosition.undefined)
                tdStart.AppendFormat(" valign=\"{0}\"", GridVAlign);

            if (cell != null)
            {
                if (!string.IsNullOrEmpty(writer.Grid.OnClientCellClick))
                {
                    ClientCellEventArgs ea = new ClientCellEventArgs
                                                 {
                                                     ColumnId = ColumnId,
                                                     RowIndex = cell.Row.RowIndex,
                                                     Value = cell.Value,
                                                     ClientEventType = ClientEventType.OnClientColumnClick
                                                 };

                    string content = JavaScriptConvert.SerializeObject(ea);
                    writer.Grid.JsOnData.AppendLine();
                    string jsonId = string.Format("{0}r{2}{1}click", Grid.ID, ColumnId, cell.Row.RowIndex).Replace("-",
                                                                                                                   "A");

                    writer.Grid.JsOnData.AppendFormat("{0} = {1}", jsonId, content);

                    tdStart.AppendFormat(@"onclick=""{0}(this,{1});return false""", writer.Grid.OnClientCellClick,
                                         jsonId);
                }
                if (!string.IsNullOrEmpty(writer.Grid.OnClientCellDblClick))
                {
                    ClientCellEventArgs ea = new ClientCellEventArgs
                                                 {
                                                     ColumnId = ColumnId,
                                                     RowIndex = cell.Row.RowIndex,
                                                     Value = cell.Value,
                                                     ClientEventType = ClientEventType.OnClientColumnDblClick
                                                 };

                    string content = JavaScriptConvert.SerializeObject(ea);
                    writer.Grid.JsOnData.AppendLine();
                    string jsonId =
                        string.Format("{0}r{2}{1}dblclick", Grid.ID, ColumnId, cell.Row.RowIndex).Replace("-", "A");

                    writer.Grid.JsOnData.AppendFormat("{0} = {1}", jsonId, content);

                    tdStart.AppendFormat(@"ondblclick=""{0}(this,{1});return false""", writer.Grid.OnClientCellDblClick,
                                         jsonId);
                }
                if (!string.IsNullOrEmpty(writer.Grid.OnClientCellMouseOver))
                {
                    ClientCellEventArgs ea = new ClientCellEventArgs
                                                 {
                                                     ColumnId = ColumnId,
                                                     RowIndex = cell.Row.RowIndex,
                                                     Value = cell.Value,
                                                     ClientEventType = ClientEventType.OnClientColumnMouseOver
                                                 };

                    string content = JavaScriptConvert.SerializeObject(ea);
                    writer.Grid.JsOnData.AppendLine();
                    string jsonId =
                        string.Format("{0}r{2}{1}mouseover", Grid.ID, ColumnId, cell.Row.RowIndex).Replace("-", "A");

                    writer.Grid.JsOnData.AppendFormat("{0} = {1}", jsonId, content);

                    tdStart.AppendFormat(@"onmouseover=""{0}(this,{1});return false""",
                                         writer.Grid.OnClientCellMouseOver, jsonId);
                }
                if (!string.IsNullOrEmpty(writer.Grid.OnClientCellMouseOut))
                {
                    ClientCellEventArgs ea = new ClientCellEventArgs
                                                 {
                                                     ColumnId = ColumnId,
                                                     RowIndex = cell.Row.RowIndex,
                                                     Value = cell.Value,
                                                     ClientEventType = ClientEventType.OnClientColumnMouseOut
                                                 };

                    string content = JavaScriptConvert.SerializeObject(ea);
                    writer.Grid.JsOnData.AppendLine();
                    string jsonId =
                        string.Format("{0}r{2}{1}mouseout", Grid.ID, ColumnId, cell.Row.RowIndex).Replace("-", "A");

                    writer.Grid.JsOnData.AppendFormat("{0} = {1}", jsonId, content);

                    tdStart.AppendFormat(@"onmouseout=""{0}(this,{1});return false""", writer.Grid.OnClientCellMouseOut,
                                         jsonId);
                }
            }
            tdStart.Append(">");

            writer.Write(tdStart);

            if (NonBreaking)
                writer.Write("<span class=\"wgnowrap\">");

            if (AllowEditInGrid)
            {
                if (Grid != null)
                    if (Grid.MasterTable.Columns.Primarykeys == null ||
                        Grid.MasterTable.Columns.Primarykeys.Count == 0)
                        throw new ApplicationException(
                            string.Format(
                                "Using 'AllowEditInGrid' property requires one or more columns in '{0}' to be a primary key.",
                                Grid.ID));
                RenderEditView(writer, cell);
                if (Identity == false && AllowEdit)
                    if (Grid != null) Grid.m_StoredAllowEditInGrid = true;
            }
            else
                RenderLabelView(writer, cell);
            if (NonBreaking)
                writer.Write("</span>");

            writer.Write("</td>");
        }
Ejemplo n.º 5
0
        internal override void RenderEditView(HtmlTextWriter writer, RowCell cell)
        {
            if (Table.m_GotData == false) // Data need to be recovered if CacheDatasourceStructure is active.
                Table.GetData(true);

            if (Identity || AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false))
            {
                RenderLabelView(writer, cell);
                return;
            }

            if (string.IsNullOrEmpty(ValueColumn))
                throw new GridException(
                    String.Format(Table.m_Grid.GetSystemMessage("SystemMessage_ForeignkeyNoValueColumn"), Title));

            StringBuilder s = new StringBuilder(string.Empty);

            switch (ForeignkeyType)
            {
                case ForeignkeyType.Select:
                case ForeignkeyType.SelectMenu:
                    {
                        StringBuilder eventScript = new StringBuilder(string.Empty);
                        StringBuilder javascript = new StringBuilder(string.Empty);
                        if (AutoPostback || string.IsNullOrEmpty(ConfirmMessage) == false)
                        {
                            eventScript = new StringBuilder(" onchange=\"");
                            if (string.IsNullOrEmpty(ConfirmMessage) == false)
                                eventScript.AppendFormat(" if(wgconfirm('{0}',this,'{1}')) ",
                                                         ConfirmMessage.Replace("'", "\\'"),
                                                         Grid.DialogTitle.Replace("'", "\\'"));
                            string link = Grid.EnableCallBack && !ForcePostBack
                                              ? Asynchronous.GetCallbackEventReference(Grid,
                                                                                       string.Format(
                                                                                           "ElementPostBack!{0}!{1}",
                                                                                           ColumnId,
                                                                                           cell.Row.PrimaryKeyValues),
                                                                                       false,
                                                                                       string.Empty,
                                                                                       string.Empty)
                                              : Grid.Page.ClientScript.GetPostBackEventReference(Grid,
                                                                                                 string.Format(
                                                                                                     "ElementPostBack!{0}!{1}",
                                                                                                     ColumnId,
                                                                                                     cell.Row.
                                                                                                         PrimaryKeyValues));
                            eventScript.AppendFormat("{0}\"", link);
                        }

                        StringBuilder onblur = new StringBuilder(" onblur=\"");

                        if (Grid.ColumnChangedColour != Color.Empty)
                            onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour));
                        onblur.Append("\"");
                        javascript.Append(onblur);
                        s.AppendFormat("<select {0} class=\"wgeditfield wgselectbox {4}\" id=\"{1}\" name=\"{1}\" {2} {3}>",
                                       javascript, cell.CellClientId, eventScript, Attributes,CssClass);
                        if (m_Foreignkeytype == ForeignkeyType.SelectMenu && ( Grid.Scripts == null || !Grid.Scripts.DisableSelectMenu))
                            if (SelectMenuWidth > 0)
                                Grid.AddClientScript(writer,
                                                     string.Format(
                                                         "$(document).ready(function() {{$('#{0}').selectmenu({{maxHeight: {2},style:'dropdown',width: {1}}});}});",
                                                         cell.CellClientId, SelectMenuWidth, SelectMenuMaxHeight));
                            else
                                Grid.AddClientScript(writer,
                                                     string.Format(
                                                         "$(document).ready(function() {{$('#{0}').selectmenu({{maxHeight: {1},style:'dropdown'}});}});",
                                                         cell.CellClientId, SelectMenuMaxHeight));

                        if (Table.Rows.Count == 0 && NullText == null)
                            NullText = "No data available.";

                        if (NullText != null)
                            s.AppendFormat("<option value=\"{1}\">{0}</option>", NullText, string.Empty);

                        //CreateRows(Grid,tree,null,0);

                        s.Append(CreateSelectRows(TreeParentId != null, null, 0, cell));
                        s.Append("</select>");
                    }
                    break;
                case ForeignkeyType.Radiobuttons:
                    m_IsFormElement = false;
                    m_Rowcounter = RecordsPerRow;
                    s.AppendFormat("<table class=\"wgradiobuttons {1}\"><tr><td>{0}</td></tr></table>",
                                   CreateRadioButtons((TreeParentId != null), null, 0, cell),CssClass);
                    break;
            }

            if (string.IsNullOrEmpty(ToolTipInput) == false)
                s = new StringBuilder(Tooltip.Add(s.ToString(), ToolTipInput));

            EditHtml(s.ToString(), writer, cell);
        }
Ejemplo n.º 6
0
 internal virtual void RenderLabelView(HtmlTextWriter writer,RowCell cell)
 {
     m_IsFormElement = false;
     RenderGrid(DisplayText(cell), writer, cell);
 }
Ejemplo n.º 7
0
        private void DesignRenderDetail(HtmlTextWriter writer,RowCell cell)
        {
            // 16.10.2004, jorn - Kommenterte ut EditAlign....

            if (Grid.BasicDetailLayout)
                RenderEditView(writer,cell);
            else
            {
                StringBuilder tdStart = new StringBuilder("<td ");

                if (cell != null && cell.InternalCellSpan > 0)
                    tdStart.AppendFormat(" colspan=\"{0}\"", cell.InternalCellSpan);
                if (WidthColumnTitle != Unit.Empty)
                    tdStart.AppendFormat(" width=\"{0}\"", WidthColumnTitle);

                // 16.10.2004, jorn - Det er dataene vi skal aligne, ikke selve input boksen.
                // ja?
                if (ColumnType == ColumnType.GridColumn && EditAlign != HorizontalPosition.Undefined)
                    tdStart.AppendFormat(" align=\"{0}\"", EditAlign);

                if (EditVAlign != VerticalPosition.undefined)
                    tdStart.AppendFormat(" valign=\"{0}\"", EditVAlign);

                if (CssClass != null)
                    tdStart.AppendFormat(" class=\"wgdetailcell {0}\">", CssClass);
                else
                    tdStart.Append(" class=\"wgdetailcell\">");
                writer.Write(tdStart);
                RenderEditView(writer,cell);

                writer.Write("</td>");
            }
        }
Ejemplo n.º 8
0
        internal void RenderGrid(object strValue, HtmlTextWriter writer,RowCell cell)
        {
            if (strValue == null)
            {
                LabelHtml(null, writer, cell);
                return;
            }

            object theValueToShow = strValue;
            if (HtmlEncode)
                theValueToShow = HttpUtility.HtmlEncode(theValueToShow.ToString());

            string s = theValueToShow.ToString();

            if (Grid.DisplayView == DisplayView.Grid)
            {
                if (TextTruncate > 0 && s.Length > TextTruncate)
                {
                    string[] words = s.Split(' ');
                    if (words.Length == 1)
                    {
                        s = string.Format("{0} <b>..</b>", s.Substring(0, TextTruncate));
                        if (m_HyperLinkColumn == null)
                            HyperLinkColumn = true;
                    }
                    else
                    {
                        StringBuilder truncatedmsgBuilder = new StringBuilder();

                        for (int i = 0; i < words.Length; i++)
                        {
                            if (i == 0 && words[i].Length > TextTruncate)
                            {
                                s = string.Format("{0} <b>..</b>", words[i].Substring(0, TextTruncate));
                                if (m_HyperLinkColumn == null)
                                    HyperLinkColumn = true;
                                break;
                            }
                            if ((truncatedmsgBuilder.Length + words[i].Length) > TextTruncate)
                            {
                                s = string.Format("{0} <b>..</b>", truncatedmsgBuilder);
                                if (m_HyperLinkColumn == null)
                                    HyperLinkColumn = true;
                                break;
                            }
                            truncatedmsgBuilder.AppendFormat(" {0}", words[i]);
                        }
                    }
                }
                if (HyperLinkColumn)
                {
                    if (Grid.Page != null)
                    {
                        string argument;
                        if (cell.Row.RowType == RowType.Group)
                            argument = string.Format("GroupClick!{0}!{1}!{2}!{3}",
                                                     cell.Row.GroupColumnID, cell.Row[cell.Row.GroupColumnID].DataSourceValue, cell.Row.PrimaryKeyValues,cell.Row.GroupIsExpanded);
                        else argument = string.Format("RecordClick!{0}!{1}", ColumnId, cell.Row.PrimaryKeyValues);
                        string link = Grid.EnableCallBack
                                          ? Asynchronous.GetCallbackEventReference(Grid, argument
                                                                                   ,
                                                                                   false, string.Empty, string.Empty)
                                          : Grid.Page.ClientScript.GetPostBackEventReference(Grid, argument);

                        string b = (string.IsNullOrEmpty(ConfirmMessage))
                                       ? string.Empty
                                       : string.Format("if(wgconfirm('{0}',this,'{1}')) ",
                                                       ConfirmMessage.Replace("'", "\\'"),
                                                       Grid.DialogTitle.Replace("'", "\\'"));

                        if (Grid.PopupExtender == null)
                            s = string.Format("<a class=\"wglinkfield\" href=\"#\" onclick=\" {0}{1}\">{2}</a>", b, link,
                                              s);
                        else if (Grid.Scripts == null ||
                                 (!Grid.Scripts.DisableJQuery && !Grid.Scripts.DisablePopupExtender))
                        {
                            string title = string.Empty;
                            if (Grid.PopupExtender.Title != null)
                                title = string.Format(" title=\"{0}\" ",
                                                      HttpUtility.HtmlEncode(Grid.PopupExtender.Title));
                            s =
                                string.Format(
                                    "<a class=\"wgpopupiframe wglinkfield\"{5}href=\"{2}?DetailPopupKeys={1}&amp;TB_Grid=true&amp;TB_iframe=true&amp;height={3}&amp;width={4}\">{0}</a>",
                                    s, cell.Row.PrimaryKeyValues,
                                    Grid.PopupExtender.Url, Grid.PopupExtender.Height, Grid.PopupExtender.Width,
                                    title);

                            Grid.AddClientScript(writer,
                                                 string.Format(
                                                     @"$(document).ready(function() {{$("".wgpopupiframe"").colorbox({{ width: ""{1}px"", height: ""{0}px"", iframe: true }});}});",
                                                     Grid.PopupExtender.Height, Grid.PopupExtender.Width));
                        }

                    }
                }
                StringBuilder indentBuilder = new StringBuilder();
                if (TreeLevel > 0)
                {
                    for (int i = 0; i < TreeLevel; i++)
                        indentBuilder.Append(TreeIndentText);
                    s = indentBuilder + s;
                }
            }
            LabelHtml(s, writer,cell);
        }
Ejemplo n.º 9
0
        internal virtual void RenderEditView(HtmlTextWriter writer, RowCell cell)
        {
            if (Identity | AllowEdit == false || (Grid.DisplayView == DisplayView.Grid && AllowEditInGrid == false))
            {
                RenderLabelView(writer, cell);
                return;
            }
            GetColumnPostBackData(cell);

            string uniqueID = cell.CellClientId;

            string theValueToShow = DisplayText(cell);
            theValueToShow = HttpUtility.HtmlEncode(theValueToShow);

            StringBuilder cssstyle = new StringBuilder();
            if (WidthEditableColumn != Unit.Empty)
                cssstyle.AppendFormat("width: {0};", WidthEditableColumn);
            if (HeightEditableColumn != Unit.Empty)
                cssstyle.AppendFormat("height: {0};", HeightEditableColumn);

            if (EditAlign != HorizontalPosition.Undefined)
                cssstyle.AppendFormat("text-align: {0};", EditAlign);

            StringBuilder onblur = new StringBuilder(" onblur=\"");
            string script = string.Empty;
            if (Grid.InputHighLight != Color.Empty)
            {
                script =
                    string.Format(
                        " onfocus=\"this.accessKey = style.backgroundColor;style.backgroundColor='{0}';\"",
                        Grid.ColorToHtml(Grid.InputHighLight));
                onblur.Append("style.backgroundColor=this.accessKey;");
            }
            if (Grid.ColumnChangedColour != Color.Empty)
                onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(Grid.ColumnChangedColour));

            if (AutoPostback)
            {
                onblur.Append("if(hasChanged(this))");
                onblur.Append(Grid.EnableCallBack && !ForcePostBack
                                  ? Asynchronous.GetCallbackEventReference(Grid,
                                                                           string.Format("ElementPostBack!{0}!{1}",
                                                                                         ColumnId,
                                                                                         cell.Row.PrimaryKeyValues),
                                                                           false,
                                                                           string.Empty, string.Empty).Replace(
                                        "javascript:", "")
                                  : Grid.Page.ClientScript.GetPostBackEventReference(Grid,
                                                                                     string.Format(
                                                                                         "ElementPostBack!{0}!{1}",
                                                                                         ColumnId,
                                                                                         cell.Row.PrimaryKeyValues)));

            }
            onblur.AppendFormat("\"{0}", script);

            string mask = null;

            if (!DisableMaskedInput && GenerateColumnMask != null)
            {
                string maskId = string.Format("{0}_{1}", Grid.ID, ColumnId);
                if (!Grid.MaskedColumns.ContainsKey(maskId))
                    Grid.MaskedColumns.Add(maskId, GenerateColumnMask);

                mask = string.Format(" alt=\"{0}\"", maskId);
            }
            string s = string.Format(
                "<input type=\"text\" {0} {4}{5} class=\"wgeditfield\" style=\"{1}\" value=\"{2}\" id=\"{3}\" name=\"{3}\"/>",
                onblur, cssstyle, theValueToShow, uniqueID, Attributes, mask);

            if (string.IsNullOrEmpty(m_ToolTipInput) == false)
                s = Tooltip.Add(s, m_ToolTipInput);

            EditHtml(s, writer, cell);
        }
Ejemplo n.º 10
0
 internal void Render(HtmlTextWriter writer, RowCell cell)
 {
     if (cell.Row.CellsToSpan > 0)
         cell.Row.CellsToSpan--;
     else
     {
         if (cell.ExtraCellSpan > 0)
             cell.Row.CellsToSpan += cell.ExtraCellSpan;
         if (Grid.DisplayView == DisplayView.Grid)
             DesignRenderGrid(writer, cell);
         else
             DesignRenderDetail(writer, cell);
     }
 }
Ejemplo n.º 11
0
        internal void LabelHtml(string text, HtmlTextWriter writer, RowCell cell)
        {
            if (string.IsNullOrEmpty(PreGridText) == false && m_Grid.DisplayView == DisplayView.Grid)
                writer.Write(PreGridText);
            else if (string.IsNullOrEmpty(PreDetailText) == false && m_Grid.DisplayView == DisplayView.Detail)
                writer.Write(PreDetailText);

            writer.Write(text);

            if (string.IsNullOrEmpty(PostGridText) == false && m_Grid.DisplayView == DisplayView.Grid)
                writer.Write(PostGridText);
            else if (string.IsNullOrEmpty(PostDetailText) == false && m_Grid.DisplayView == DisplayView.Detail)
                writer.Write(PostDetailText);
        }
Ejemplo n.º 12
0
        internal void EditHtml(string text, HtmlTextWriter writer,RowCell cell)
        {
            string systemMessage = null;
            if (cell.Row != null && Grid.SystemMessage[cell.Row.GetColumnInitKeys(ColumnId)] != null)
                systemMessage = Grid.SystemMessage[cell.Row.GetColumnInitKeys(ColumnId)].Message;

            if (TreeLevel > 0 && Grid.DisplayView == DisplayView.Grid)
            {
                StringBuilder indent = new StringBuilder(string.Empty);
                for (int i = 0; i < TreeLevel; i++)
                    indent.Append(TreeIndentText);
                writer.Write("<span class=\"wgnowrap\">");
                writer.Write(indent);
            }

            if (string.IsNullOrEmpty(PreDetailText) == false && m_Grid.DisplayView == DisplayView.Detail)
                writer.Write(PreDetailText);
            if (string.IsNullOrEmpty(PreGridText) == false && m_Grid.DisplayView == DisplayView.Grid)
                writer.Write(PreGridText);

            if (systemMessage != null && (SystemMessageStyle == SystemMessageStyle.WebGrid) == false)
            {
                string jqueryuicss = "";
                if (m_Grid.IsUsingJQueryUICSSFramework)
                    jqueryuicss = "ui-state-error-text ";
                switch (SystemMessageStyle)
                {
                    case SystemMessageStyle.ColumnLeft:
                        writer.Write("<div class=\"{1}wgsystemmessagetitle\">{0}</div>", systemMessage, jqueryuicss);
                        break;
                    case SystemMessageStyle.ColumnTop:
                        writer.Write("<div class=\"{1}wgsystemmessagetitle\">{0}</div><br/>", systemMessage, jqueryuicss);
                        break;
                }
            }
             /*  if (m_GridViewTemplate != null && m_Grid.DisplayView == DisplayView.Grid)
                writer.Write(RenderGridViewTemplate(cell));
            else if (m_DetailViewTemplate != null && m_Grid.DisplayView == DisplayView.Detail)
                writer.Write(RenderDetailViewTemplate(cell));
            else*/
                writer.Write(text);

            if (systemMessage != null && (SystemMessageStyle == SystemMessageStyle.WebGrid) == false)
            {
                string jqueryuicss = "";
                if (m_Grid.IsUsingJQueryUICSSFramework)
                    jqueryuicss = "ui-state-error-text ";
                switch (SystemMessageStyle)
                {
                    case SystemMessageStyle.ColumnRight:
                        writer.Write("<div class=\"wgsystemmessagetitle\">{0}</div>", systemMessage, jqueryuicss);
                        break;
                    case SystemMessageStyle.ColumnBottom:
                        writer.Write("<br/><div class=\"wgsystemmessagetitle\">{0}</div>", systemMessage, jqueryuicss);
                        break;
                }
            }
            if (TreeLevel > 0 && Grid.DisplayView == DisplayView.Grid)
                writer.Write("</span>");
            if (string.IsNullOrEmpty(PostDetailText) == false && m_Grid.DisplayView == DisplayView.Detail)
                writer.Write(PostDetailText);
            else if (string.IsNullOrEmpty(PostGridText) == false && m_Grid.DisplayView == DisplayView.Grid)
                writer.Write(PostGridText);
        }