Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

HI, I need to remove a querystring when a user clicks a particular LinkButton. So for example if the querystring is http://UserProfileManager.com?UserID=1234 .... when the user clicks on the Linkbutton, I want the url to be http://UserProfileManager.com. The issue is that everything is on one page, and I am using asp:panel to show and hide different areas of the webpage.

Any ideas would be appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
259 views
Welcome To Ask or Share your Answers For Others

1 Answer

You have several options:

1) In your code behind, just set the LinkButton's URL to the shorter address if the querystring contains a "UserID" key:

if (Request.QueryString["UserID"] != null) {
    this.LinkButton.PostBackUrl = "http://UserProfileManager.com";
} else {
    // other address
}

2) Send the UserID in a hidden field instead of the querystring.

3) Separate your view and edit pages - putting everything in one *.aspx is probably going to cause more trouble than it's worth down the road.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...