想通过__dopostback来调用后台的linkBtn_onclick方法,首先测试了点击button是可以触发linkBtn_onclick方法,但是却获取不到用户输入的字符串,获取的字符串是空的,请问是哪里错了呢?要怎么获取呢?
<dl id="idBox" class="lightbox" style="top: 10%; left: 5%;">
<dd>
<asp:Label ID="Label8" runat="server" Text="内容:"></asp:Label>
<textarea id="replyContent" name="replyContent" cols="32" rows="4"></textarea>
<br />
<asp:LinkButton ID="linkBtn" runat="server" onclick="linkBtn_onclick"></asp:LinkButton>
<input id="sendmes" type="button" value="私信" onclick="__doPostBack('linkBtn','linkBtn_onclick')"/>
</dd>
</dl>protected void linkBtn_onclick(object sender, EventArgs e)
{
string mes = Request.Form["replyContent"];
}
<script type="text/javascript">
(function () { var ab = new AlertBox("idBox"), lock = false;
$$("idBoxOpen").onclick = function () { ab.center = true;
ab.show();
}
})()</script>
<dl id="idBox" class="lightbox" style="top: 10%; left: 5%;">
<dd>
<asp:Label ID="Label8" runat="server" Text="内容:"></asp:Label>
<textarea id="replyContent" name="replyContent" cols="32" rows="4"></textarea>
<br />
<asp:LinkButton ID="linkBtn" runat="server" onclick="linkBtn_onclick"></asp:LinkButton>
<input id="sendmes" type="button" value="私信" onclick="__doPostBack('linkBtn','linkBtn_onclick')"/>
</dd>
</dl>protected void linkBtn_onclick(object sender, EventArgs e)
{
string mes = Request.Form["replyContent"];
}
<script type="text/javascript">
(function () { var ab = new AlertBox("idBox"), lock = false;
$$("idBoxOpen").onclick = function () { ab.center = true;
ab.show();
}
})()</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货