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


C# HtmlTextWriter.Close方法代码示例

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


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

示例1: GetDynamicContent

    public static string GetDynamicContent(string contextKey)
    {
        SqlConnection conn;
        SqlCommand cmd;
        string cmdString = "Select * from Customers";

        switch (contextKey)
        {
            case ("1"):
                cmdString = "Select * from Employees";
                break;
            case ("2"):
                cmdString = "Select * from Products";
                break;
        }

        conn = new
            SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;User Instance=True");
        cmd = new SqlCommand(cmdString, conn);
        conn.Open();

        SqlDataReader myReader;
        myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

        DataTable dt = new DataTable();
        dt.Load(myReader);
        myReader.Close();

        GridView myGrid = new GridView();
        myGrid.ID = "GridView1";
        myGrid.DataSource = dt;
        myGrid.DataBind();

        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);

        myGrid.RenderControl(htw);
        htw.Close();

        return sw.ToString();
    }
开发者ID:kacecode,项目名称:SchoolWork,代码行数:41,代码来源:DynamicPopulateExtender.aspx.cs

示例2: GetCallbackResult

        protected virtual string GetCallbackResult() {
            StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture);
            // 
            HtmlTextWriter writer = new HtmlTextWriter(stringWriter);
            IStateFormatter2 formatter = StateFormatter;

            RenderTableContents(writer);

            writer.Flush();
            writer.Close();

            string dataKeysString = formatter.Serialize(SaveDataKeysState(), Purpose.WebForms_GridView_DataKeys);
            string sortExpressionString = formatter.Serialize(SortExpression, Purpose.WebForms_GridView_SortExpression);

            // this should return the html that goes in the panel, plus the new page and sort info.
            return Convert.ToString(PageIndex, CultureInfo.InvariantCulture) + "|" + Convert.ToString((int)SortDirection, CultureInfo.InvariantCulture) + "|" + sortExpressionString + "|" + dataKeysString + "|" + stringWriter.ToString();
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:17,代码来源:GridView.cs

示例3: GetCallbackResult

        protected virtual string GetCallbackResult() {
            StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture);
            // 
            HtmlTextWriter writer = new HtmlTextWriter(stringWriter);
            IStateFormatter2 formatter = Page.CreateStateFormatter();

            RenderTableContents(writer);

            writer.Flush();
            writer.Close();

            object dataKeyState = OrderedDictionaryStateHelper.SaveViewState(KeyTable);
            string dataKeyString = formatter.Serialize(dataKeyState, Purpose.WebForms_DetailsView_KeyTable);

            // this should return the html that goes in the panel, plus the new page info.
            return Convert.ToString(PageIndex, CultureInfo.InvariantCulture) + "|" + dataKeyString + "|" + stringWriter.ToString();
        }
开发者ID:uQr,项目名称:referencesource,代码行数:17,代码来源:DetailsView.cs

示例4: Render

    //-------------------------------------------------------------------------------------------
    protected override void Render(HtmlTextWriter writer)
    {
        MemoryStream ms = new MemoryStream();
               StreamWriter sw = new StreamWriter(ms);
               HtmlTextWriter htw = new HtmlTextWriter(sw);

               base.Render(htw);
               htw.Flush();
               ms.Position = 0;

               TextReader tr = new StreamReader(ms);
               string output = tr.ReadToEnd();
               string newOutput = ReplaceWithAppPath(output);
               writer.Write(newOutput);

               htw.Close();
               sw.Close();
               ms.Close();
    }
开发者ID:weavver,项目名称:weavver,代码行数:20,代码来源:MasterPage.master.cs


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