我正在使用 jSignature 来捕获用户签名,之后我想将其放入数据库中,我显示了签名面板,当我将数据发送到警报框时,我可以看到它,我也有一个 asp。页面中的net隐藏字段是我正在存储数据,问题是我无法将数据放入我的代码中,因此我可以将其存储在数据库中。
<telerik:RadCodeBlock runat="server">
<script src="../Scripts/JSignature/jquery-1.9.0.min.js"></script>
<script src="../Scripts/JSignature/jSignature.min.js"></script>
<script type="text/javascript">
function SaveCanvasImage() {
var image = $('#signature').jSignature('getData', 'base30');
var hdnField = $('#<%= hdnSignature.ClientID %>');
$('#<%=btnHidden.ClientID %>').click();
return false;
}
</script>
<script>
function pageLoad() {
InitSignaturePanel(); //this is a function in a global js file.
}
</script>
</telerik:RadCodeBlock>
<!--[if lt IE 9]>
<script type="text/javascript" src="../Scripts/JSignature/flashcanvas.js"></script>
<![endif]-->
<telerik:RadScriptManager runat="server"></telerik:RadScriptManager>
<div class="width400">
<telerik:RadAjaxPanel runat="server"> <asp:Label runat="server" ID="lblHidden" />
<asp:HiddenField runat="server" ID="hdnSignature" />
<div id="signature" class="trueMargin signaturePanel"></div>
</telerik:RadAjaxPanel>
<div class="textAlignCenter">
<br />
<input type="button" id="clearCanvas" value="Reset" onclick="$('#signature').jSignature('clear')" />
<asp:Button id="btnCaptureCanvas" runat="server" Text="Save and Close" OnClientClick="SaveCanvasImage()" />
<asp:Button runat="server" ID="btnHidden" OnClick="btnHidden_Click" />
</div>
</div>
在我背后的代码中:
protected void btnHidden_Click(object sender, EventArgs e)
{
lblHidden.Text = hdnSignature.Value;
}