How to add Querystring parameter from code behind using javascript in asp.net?

I am opening the onClick event of the page using javascript from the code behind. But I want to pass the querystring parameter and access it on another page.

string id=1;
    teammember.Attributes.Add("onclick", "window.location.href='TeamMemberDetails.aspx?Id=" + Id + "'");

The code above works fine!

Now I want to add a QueryString using Javascript and access it on another page from CodeBehind.

I tried:

teammember.Attributes.Add("onclick", "window.location.href='TeamMemberDetails.aspx?Id=" + Id + "'" + "&isabout=true");

but it does not work!

As conditional redirects using HTML binding:

 <a style="border: 0px none; float: left;" href="TeamMember.aspx">

            <img alt="<--" src="Images/ArrowLeft.png" style="display: inline-block; cursor: pointer;
                border: 0 none;" />
        </a>

In the section above, I want to set conditional forwarding depending on the Querystring parameter?

For example: if isabout = true, and then redirect to TeamMember.aspx else Other.aspx Help evaluate! Thanks

+5
source share
1

' . ' href.

.

teammember.Attributes.Add("onclick", "window.location.href='TeamMemberDetails.aspx?Id=" + Id + "'" + "&isabout=true");

.

teammember.Attributes.Add("onclick", "window.location.href='TeamMemberDetails.aspx?Id=" + Id + "&isabout=true'");
+5

All Articles