0

I have a page "article.aspx" .I insert a button in this page and i want after click on this button a value added to the url for example article.aspx?id=67 .

The important thing is how can i do this without redirect method?

   response.redirect("article.aspx?id=67")

thank you .

10
  • You cannot take the user to a different URL without redirecting. Commented Feb 11, 2014 at 19:31
  • I don't want to change the url ,i just want to add a value to the current url Commented Feb 11, 2014 at 19:32
  • 1
    That's exactly what change means. Commented Feb 11, 2014 at 19:33
  • I need to send value to current page Commented Feb 11, 2014 at 19:33
  • Please explain why you want to do that? May be what you are asking isn't needed. Commented Feb 11, 2014 at 19:39

1 Answer 1

1

Try updating your PostbackURL.

In your codebehind, you could do something along the lines of (assuming your link has the ID myLink)

If you want to post the form data back to the next page:

if (condition == true) 
{
 myLink.PostbackUrl = "article.aspx?id=67";
}

If you want to just go to the next page without posting the form, you'd use

if (condition == true) 
{
 myLink.NavigateUrl = "article.aspx?id=67";
}

You'll need to modify this based on what you're trying to do, but this is really the only way I can think of to do what you need to.

Sign up to request clarification or add additional context in comments.

1 Comment

myLink would be either an ASP.NET HyperLink control or a LinkButton control. You need something on the page for the user to click for this to work if you can't use a redirect. Depending on which one you use you may expose either the NavigateURL or PostbackUrl properties.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.