简体   繁体   中英

How do i print a value in my markup from the code behind file

I have this code in my markup:

<form id="myfileupload" action="/_layouts/IrvineCompany.SharePoint.CLM/aspx/Upload.ashx?ProjectApprovalId=" method="post" enctype="multipart/form-data">

If you look at the url in the action property:

/_layouts/IrvineCompany.SharePoint.CLM/aspx/Upload.ashx?ProjectApprovalId=

I want to be able to add a number at the end of ProjectApprovalId from a variable in the codebehind file. How can i accomplish this?

Can you try:

/_layouts/IrvineCompany.SharePoint.CLM/aspx/Upload.ashx?ProjectApprovalId= <%=VariableName%>

From an ASP.NET point of view you will have to make the form object a server-side object to access it in codebehind.

like

 <form runat="server" id="form1">

Depending on your needs, you can post the form to itself and then, in code-behind, do:

...
Response.Redirect ("/_layouts/IrvineCompany.SharePoint.CLM/aspx/Upload.ashx?ProjectApprovalId=" + yourVariableName);
...

It will redirect to the handler and you can pass whatever you want as QueryString

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM