简体   繁体   中英

Posting hidden field and values from C#

Hi I am trying to achieve following in c# where I want to post xml data to a url where cxml-urlencoded is an hidden field.

<FORM METHOD=POST ACTION=<%= url%>>
<INPUT TYPE=HIDDEN NAME="cxml-urlencoded" VALUE="<% CreateCXML toUser,
fromUser, buyerCookie, unitPrice, supPartId, supPartAuxId, desc%>">
<INPUT TYPE=SUBMIT value=BUY>
</FORM>

I tried doing it

string  myurl=(uri+Server.UrlEncode(str1));
      Response.Write(@"<a input type=""hidden"" name=""cxml-urlencoded"" value=""myurl""></a>"); 
      Response.Close();

Any ideas how to best go about it?

Insert a HiddenField server control in the page

<asp:HiddenField runat="server" ID="hdXML"/>

and set the value in the hidden fields from code behind as

hdXml.Value = CreateCXML(toUser, fromUser, buyerCookie, unitPrice, supPartId, supPartAuxId, desc);

Make sure you have the CreateCXML function declared and returning string.

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