i have query string i'd pass razor view. example.com/25?type=1&assigned=1
i want change html based on if query string contains values. tried doing
@if (request.querystring["type=1&assigned=1"]) { <button id="type1" class="btn-t btn-success type-button" onclick="settype(1);"><i class="fa fa-info-circle fa-fw"></i>invitation</button> } else { <button id="type1" class="btn-t btn-xxxx type-button" onclick="settype(1);"><i class="fa fa-info-circle fa-fw"> </i>invitation</button> } but displayed else. doing wrong?
request.querystring not boolean value, don't understand donig. namevaluecollection type. if still want check should write this:
@if (request.querystring["type"] == "1" && request.querystring["assigned"] == "1") { ... } but it's bad practice manipulate querystring in mvc. use strongly typed views , don't mess request itself.
Comments
Post a Comment