Avoiding redundant code in MVC view page
Most of your code is duplicated, what I did is extract the logic to the first code block, and left only the placeholders in the HTML.

@{
    bool savingHtml = (Request.QueryString["savehtml"] == "1");
    string activeTab = Request.QueryString["from"];
    string tabContent = Html.Partial("~/Views/Shared.MultiQuery/_resultset.cshtml", Model);
    string heatClass, tableClass;
    string tableId = "table";
    string heatId = "heat";
    string heatTabContent, tableTabConten;

    if (savingHtml &amp;&amp; activeTab.ToLower() != "index") {
        heatClass = "active";
        heatTabContent = tabContent;
        tableId += "2";
        heatId += "2";
    } else {
        tableClass = "active";
        tableTabContent = tabContent;
        if (savingHtml) {
            tableId += "1";
            heatId += "1";
        }
    }
}

&lt;div class="summaryTab"&gt;
  &lt;ul class="nav nav-tabs" data-tabs="tabs"&gt;
    &lt;li class="@heatClass"&gt;&lt;a data-toggle="tab" href="#heat"&gt;Heat Map&lt;/a&gt;&lt;/li&gt;
    &lt;li class="@tableClass"&gt;&lt;a data-toggle="tab" href="#table"&gt;Table&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
&lt;div class="tab-content"&gt;
    &lt;div class="tab-pane active" id="@tableId"&gt;
        @tableTabContent
    &lt;/div&gt;
    &lt;div class="tab-pane" id="@heatId"&gt;
        @heatTabContent
    &lt;/div&gt;

&lt;/div&gt;



Note: I have no experience with ASP.Net, so I apologize if the code is not as clean as possible, or has any syntax errors... The gist of the matter is still that if you extract the logic, you get shorter and cleaner code, with much less copy+paste...