问题描述
可能重复:结果
我有一个谷歌结帐立即购买按钮,并在尝试添加动态创建的内容单击时发送。使用原始的HTML被证明是有点难度,所以我想创建一个ASP.Net 的ImageButton
代替了。
I have a google checkout "buy now" button, and am trying to add dynamically created content to send when it's clicked. Using the original html is proving a bit difficult so I want to create an ASP.Net ImageButton
Instead of that.
我已经成功地创造与右侧图像按钮,钩住它在codebehind事件处理程序。
I've succeeded in creating the button with the right image, and hooking it up to an event handler in the codebehind.
不过,我不知道到底发生了什么时,原来的按钮被点击,为了尝试和效仿新的的ImageButton
。
However, I'm not sure what exactly happens when the original button is clicked, in order to try and emulate it in the new ImageButton
.
原来的code是:
<form action="https://sandbox.google.com/checkout/..." id="Form1" method="post" name="..." target="_top">
<input name="item_name_1" type="hidden" value="..." />
...
<input alt="" src="https://sandbox.google.com/checkout/buttons/buy.gif?merchant_id=..." type="image" />
</form>
和我要放置一个动态创建的 ITEM_NAME_1
。
And I want to place a dynamically created item_name_1
.
我有什么在该的button1_Click
的方法呢?
What do I have to do in the Button1_Click
method for that?
推荐答案
短,简洁的有用的版本:
HTML:
<form id="__parent" action="..." method="post" runat="server">
<input id="__child0" name="type" type="hidden" value="button" runat="server" />
<input id="__child1" name="name" type="hidden" value="teh_button" runat="server" />
<input id="__child2" name="value" type="hidden" value="Hello?" runat="server" />
</form>
tehfile.cs:
tehfile.cs:
<%@ Page Language="C#" CodeFile="tehfile.cs" %>
String
_type = __child0.Value,
_name = __child1.Value,
_value = __child2.Value,
_element = String.Format(
"<{0} {1}=\"{2}\" {3}=\"{4}\" {5}=\"{6}\" />",
"input",
"type", _type,
"name", _name,
"value", _value );
Literal _lit = new Literal( );
_lit.Text = _element;
__parent.AddControl( _lit );
这篇关于碰巧的&QUOT什么;输入&QUOT;在[提交&QUOT;?如何才能通过ASP.Net做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!