StringBuilder returing Web script

Posted on

Problem

Task : With the page_type and currentpage param I made this code that returns the web script of the web page with active class on the current page through aspx behind code.

Is there a better and a shorter way of code that works just like the code below? (The difference is the else if(page_type == sales) script.append part)

protected string MakeBottomMenu(string page_type)
{
StringBuilder script = new StringBuilder();
string currentPage = System.IO.Path.GetFileName(Request.Url.AbsolutePath);

if (page_type == "office")
{
if(currentPage.Equals("commute_gps.aspx"))
script.Append($"<li class="active"">

Solution

<

a href=""commute_gps.aspx?page_type={page_type}"" class=""home"">

<

span class=""blind"">

홈<

Leave a Reply

Your email address will not be published. Required fields are marked *