Posting hidden field and values from C#

2k views Asked by At

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?

1

There are 1 answers

0
Tariqulazam On BEST ANSWER

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.