urb
Junior Member
Posts: 3
Registered: 10/10/2007
Member Is Offline
|
| posted on 10/10/2007 at 04:23 PM |
|
|
Use in ASP.NET 2.0
How can I use the tigra calculator un ASP.NET 2.0 with a textbox like this:
<asp:TextBox ID="TextBox1" runat="server" Width="4%" EnableViewState="true" ReadOnly="false">1</asp:TextBox>
I've readed a topic about a similar issue with the Tigra Calendar, and so far I can launch the html with the Calculator, but neither is the value of
the textbox passed to the calculator nor the result passed back to the control.
Is there any sample?
|
|
|
tigra
Administrator
Posts: 2050
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 10/10/2007 at 04:43 PM |
|
|
The code fragment you provided is the server side script. Calculator works on the client side. You can use view->source feature of your browser to
see the client side output of your server side script. Make sure the output is similar to the code in working samples.
|
|
|
urb
Junior Member
Posts: 3
Registered: 10/10/2007
Member Is Offline
|
| posted on 10/10/2007 at 05:17 PM |
|
|
I can not use the code of working samples because I didn't have any form in my web page.
The case is quite similar to the one post with the subject: how to use tigra calendar in asp.net web forms with master page ?
I also have a master page and I've modified the web form to something similar to the solution of the calendar post.
The code of my web form is:
------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" ValidateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<script type="text/javascript" language="javascript" src="calculadora/calculator.js"></script>
<script type="text/javascript" language="javascript">
function GetCalc()
{
var cal1 = new Tcalculator();
cal1.TCRPopup(document.getElementById("ctl00_ContentPlaceHolder1_TextBox1"));
}
</script>
<div class="centrado">
<table class="sombra_laterales" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td class="sombra_superior_smart" style="width: 100%;">
<p class="titulos" style="color: white;">
Toma de datos</p>
</td>
</tr>
<tr>
<td style="width: 100%;">
<p>
Total de dA?as trabajados por <strong><span style="text-decoration: underline">todos
los trabajadores</span></strong> por cuenta ajena de la empresa:
<asp:TextBox ID="TextBox1" runat="server" Width="4%" EnableViewState="true"
ReadOnly="false">1</asp:TextBox>
<a href="javascript:GetCalc();">
<img width="15" height="13" alt="Calculadora" src="calculadora/calc.gif" style="border-top-style: none;
border-right-style: none; border-left-style: none; border-bottom-style: none;" /></a>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Campo requerido."
ControlToValidate="TextBox1" ValidationGroup="cpe">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Debe introducir un valor nA?merico mayor
que cero."
ControlToValidate="TextBox1" Operator="GreaterThan" Type="Integer" ValidationGroup="cpe"
ValueToCompare="0">*</asp:CompareValidator>
<asp:CompareValidator ID="CompareValidator4" runat="server" ErrorMessage="El valor del total de trabajadores debe
de ser mayor o igual que los trabajadores indefinidos."
ControlToCompare="TextBox2" ControlToValidate="TextBox1" Operator="GreaterThanEqual"
Type="Integer" ValidationGroup="cpe">*</asp:CompareValidator>
<br />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="cpe" />
</p>
<p style="text-align: center">
<br />
<asp:Button ID="Button1" runat="server" Text="Calcular" OnClick="Button1_Click" />
</p>
</td>
</tr>
<tr>
<td class="sombra_inferior" style="width: 100%; height: 32px;">
</td>
</tr>
</tbody>
</table>
</div>
</asp:Content>
------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------
With this code I can show the calculator, but no value is passed to the calculator or back to the textbox.
What I'm doing wrong??
Thaks for your quick reply ;)
|
|
|
urb
Junior Member
Posts: 3
Registered: 10/10/2007
Member Is Offline
|
| posted on 10/11/2007 at 07:24 AM |
|
|
Ok, I just found out a way to do that.
------------------------------------------------------------------------------------------------------------------------------------------------------
--------
<asp:TextBox ID="TextBox1" runat="server" Width="4%" EnableViewState="true" ReadOnly="false">1</asp:TextBox>;
<a href="javascript:TCR.TCRPopup(document.getElementById('ctl00_ContentPlaceHolder1_TextBox1'))">
<img width="15" height="13" alt="Calculadora" src="calculadora/calc.gif" style="border-top-style: none;
border-right-style: none; border-left-style: none; border-bottom-style: none;" /></a>
------------------------------------------------------------------------------------------------------------------------------------------------------
--------
Thanks anyway.
|
|
|