Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

asp.net render control to string

private string RenderControl()
{
    var sb = new System.Text.StringBuilder();
    using (var stWriter = new System.IO.StringWriter(sb))
    using (var htmlWriter = new HtmlTextWriter(stWriter))
    {
        var p = new Page();
        var ctrl = (YourControl)p.LoadControl("~/controls/building blocks/YourControl.ascx");
        ctrl.Visible = true;

        // do your own init logic if needed

        p.Controls.Add(ctrl);
        ctrl.RenderControl(htmlWriter);
        return sb.ToString();
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: In ASP.NET Core how check if request is local 
Csharp :: make wpf run in fullscreen but above windows taskbar 
Csharp :: how to make dobuble jump unity 2d 
Csharp :: start wpf application when windows start 
Csharp :: c# check file similarities 
Csharp :: C# remain space 
Csharp :: c# list add and return 
Csharp :: spreate by captial char in c# 
Csharp :: REMOVE BOTTOM TAB XAMARIN FORMS 
Csharp :: dfgf 
Csharp :: visual studio debug copy byte[] from watch 
Csharp :: how to unit test dbcontext in .net core 
Csharp :: how to pass id to modal in asp.net mvc 
Csharp :: Remove tabpage by key 
Csharp :: Set orientation of moving object towards it movement direction 
Csharp :: scale curve revit api 
Csharp :: EF will not create columns RULE 
Csharp :: Mirror Inverse Program in c# 
Csharp :: embergene 
Csharp :: .NET TLS 1.3 example 
Csharp :: copy properties from two subclasses c# 
Csharp :: vb.net array search 
Csharp :: c# int array add number 
Csharp :: c# capitalize first letter of each word in a string 
Csharp :: rating iOS game in unity 
Csharp :: c# if int is even 
Csharp :: web scraping dynamic content c# 
Csharp :: unity input tastiera 
Csharp :: black lives matter update arsenal 
Html :: ml5 cdn 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =