Share via

Add a aspx page value to a postbackurl querystring

peter liles 556 Reputation points
2021-09-13T14:17:52.333+00:00

How do you include a value assigned to a hidden element to a button Postbackurl. I have attempted the following code without success?

PostBackUrl='String.Format("~/MyProject/AdminManager - Copy/Messaging/Pictures.aspx?id={0}", <%=MessageID.Value %>)'

Developer technologies | ASP.NET Core | Other

Answer accepted by question author

Lan Huang-MSFT 30,211 Reputation points Microsoft External Staff
2021-09-14T09:05:17.21+00:00

Hi @peter liles ,
First, you need to pass the value to confirm whether the MessageID has a value.
I suggest that you can use Request.QueryString to accept a collection of URL query strings.

PostBackUrl='<%# String.Format("~/MyProject/AdminManager - Copy/Messaging/Pictures.aspx ?id={0}", Request.QueryString["MessageID"]) %>'  

Best regards,
Lan Huang


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.