运行效果如下:
前台 .aspx 代码
home.vue
<%@ Page Language=“C#” AutoEventWireup=“true” CodeFile=“Default.aspx.cs” Inherits=\”_Default\” %>
<%@ Register assembly=“Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” namespace=“Microsoft.Reporting.WebForms” tagprefix=“rsweb” %>
后台 .cs 文件代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Reporting.WebForms;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// 添加智能提示
loadContext();
}
#region 加载右侧的智能提示方法/// <summary>/// 加载提醒控件/// </summary>public void loadContext(){//提示信息string tipStr = \"提示信息为空,则隐藏提示框;否则显示\";//提示信息为空,则隐藏提示框;否则显示if (string.IsNullOrEmpty(tipStr)){Div1.Visible = false;return;}elseDiv1.Visible = true;//将提示表格添加到Panel容器中Table tb1 = new Table();tb1 = S1(tipStr);Panel1.Controls.Add(tb1);}/// <summary>/// 构造提示框/// </summary>/// <param name=\"conText\">提示内容</param>/// <returns>返回提示框</returns>public Table S1(string conText){#region 表格样式设置Table table = new Table();table.BorderWidth = 1;table.BorderColor = System.Drawing.Color.Black;table.CellSpacing = 0;table.CellPadding = 1;table.Width = 230;#endregion#region 标题//提示框TableRow headerRow = new TableHeaderRow();headerRow.BackColor = System.Drawing.Color.Silver;var cell1 = new TableCell();headerRow.TableSection = TableRowSection.TableHeader;Label lb = new Label();lb.Text = \"智能提醒:\";lb.Width = 205;cell1.Controls.Add(lb);headerRow.Cells.Add(cell1);table.Rows.Add(headerRow);#endregion#region 内容TableRow row6 = new TableRow();var cell61 = new TableCell();HtmlTextArea txtArea = new HtmlTextArea();txtArea.Value = conText;txtArea.Cols = 30;txtArea.Rows = 60;txtArea.Disabled = true;txtArea.Style.Add(\"color\", \"red\");txtArea.Value = conText;cell61.Controls.Add(txtArea);row6.Cells.Add(cell61);table.Rows.Add(row6);#endregionreturn table;}#endregion
}