hi
I use hiddenField and put label's value on this hiddenfield:
<asp:HiddenField ID="hfMessageCount" runat="server" />
<asp:HiddenField ID="hfCharacterCount" runat="server" />
<asp:HiddenField ID="hfTextBoxValue" runat="server" />
<asp:HiddenField ID="hfSum" runat="server" />
and below is javacode:
<script type="text/javascript">
$(function () {
var i = 0;
$('[id*=Txtmatn]').keydown(function (e) {
var ctrlKey = 67, vKey = 86;
if (e.keyCode != ctrlKey && e.keyCode != vKey) {
$('[id*=hfCharacterCount]').val(toPersianNumber($(this).val().length));
$('[id*=LbltedaCh]').html($('[id*=hfCharacterCount]').val());
$('[id*=hfTextBoxValue]').val($(this).val());
if ($(this).val().length % 70 == 0) {
i = $(this).val().length / 70;
$('[id*=lblsum]').html(i * ($('[Id*=LblTshE]').html()));
i = toPersianNumber(i);
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
else {
i = $(this).val().length / 70;
i = toPersianNumber(parseInt(i));
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
}
});
$('[id*=Txtmatn]').keyup(function (e) {
var ctrlKey = 67, vKey = 86;
if (e.keyCode != ctrlKey && e.keyCode != vKey) {
$('[id*=hfCharacterCount]').val(toPersianNumber($(this).val().length));
$('[id*=LbltedaCh]').html($('[id*=hfCharacterCount]').val());
$('[id*=hfTextBoxValue]').val($(this).val());
if ($(this).val().length % 70 == 0) {
i = $(this).val().length / 70;
$('[id*=lblsum]').html(i * ($('[Id*=LblTshE]').html()));
i = toPersianNumber(i);
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
else {
i = $(this).val().length / 70;
i = toPersianNumber(parseInt(i));
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
}
});
$("[id*=Txtmatn]").bind('paste', function (e) {
setTimeout(function () {
$('[id*=hfCharacterCount]').val(toPersianNumber($("[id*=Txtmatn]").val().length));
$('[id*=LbltedaCh]').html($('[id*=hfCharacterCount]').val());
$('[id*=hfTextBoxValue]').val($("[id*=Txtmatn]").val());
var msgCount = $("[id*=Txtmatn]").val().length / 70;
$('[id*=lblsum]').html(Math.floor(msgCount) * (Math.floor($('[Id*=LblTshE]').html())));
msgCount = toPersianNumber(Math.floor(msgCount));
$('[id*=hfMessageCount]').val(msgCount);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}, 100);
});
});
function toPersianNumber(input) {
var inputstring = input;
var persian = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"]
for (var j = 0; j < persian.length; j++) {
inputstring = inputstring.toString().replace(new RegExp(j, "g"), persian[j]);
}
return inputstring;
}
</script>
as you see here I used:
$('[id*=hfCharacterCount]').val(toPersianNumber($("[id*=Txtmatn]").val().length));
$('[id*=LbltedaCh]').html($('[id*=hfCharacterCount]').val());
$('[id*=hfTextBoxValue]').val($("[id*=Txtmatn]").val());
now I want put Lblsum value into hfsum
<asp:HiddenField ID="hfLblsum" runat="server" />
how I can do it?
Best regards
neda