aspkiddy

aspkiddy

  • NA
  • 17
  • 0

How can I retrieve values from a textBox in another screen after the user set / send it?

Jun 28 2011 8:57 AM
Hi,

How can I retrieve values ??from a textBox in another screen after the user set / send it

In the first screen, I have a TextBox, mNombre50TextBox, the user fills in the number of tickets they want in the textBox.the sum is displayed (by calculating with jQuery) in another textBox, mTotal50TextBox, and the total bill is in 3th (another) textBox, ,mMontantTextBox...

Here is my code in aspx (Front end)
[CODE]<script type="text/javascript">
  $(document).ready(function () {

  $("#<%=mNombre50TextBox.ClientID %>").keyup(function () {
  $("#<%=mTotal50TextBox.ClientID %>").attr("value", $("#<%=mNombre50TextBox.ClientID %>").attr("value") * 50);

  $("#<%=mMontantTextBox.ClientID %>").attr("value", $("#<%=mTotal50TextBox.ClientID %>").attr("value"));
  });
  $("#<%=mNombre100donnerTextBox.ClientID %>").keyup(function () {
  $("#<%=mTotal100donnerTextBox.ClientID %>").attr("value", $("#<%=mNombre100donnerTextBox.ClientID %>").attr("value") * 100);

  $("#<%=mMontantTextBox.ClientID %>").attr("value", parseInt($("#<%=mTotal50TextBox.ClientID %>").attr("value")) + parseInt($("#<%=mTotal100donnerTextBox.ClientID %>").attr("value")));



  });
 
  });
 </script>

 
 <div class="conteneur_lbl">
  <div class="lbl">
  <asp:Label ID="billets50" runat="server">Nombre de billet(s) à 50 $ :</asp:Label>
  </div>
  <div class="nmbr_txtbox">
  <asp:TextBox ID="mNombre50TextBox" Text="0" runat="server" MaxLength="3" Width="35px"></asp:TextBox>
  </div>
  <div class="dollars_txtbx">
  somme partielle :
  <asp:TextBox ID="mTotal50TextBox" runat="server" Text="0" MaxLength="6" ReadOnly="True"></asp:TextBox><span
  class="pour_cent_dollars">,00$ </span>
  </div>
  </div>
<div class="conteneur_lbl">
  <div class="lbl">
  <asp:Label ID="billets100donner" runat="server">Nombre de billet(s) à donner à 100 $ :</asp:Label>
  </div>
  <div class="nmbr_txtbox">
  <asp:TextBox ID="mNombre100donnerTextBox" Text="0" runat="server" MaxLength="3" Width="35px"></asp:TextBox>
  </div>
  <div class="dollars_txtbx">
  somme partielle :
  <asp:TextBox ID="mTotal100donnerTextBox" Text="0" runat="server" MaxLength="6" ReadOnly="True"></asp:TextBox><span
  class="pour_cent_dollars">,00$ </span>
  </div>
  </div>


 <div class="conteneur_lbl">
  <div class="lbl">
  <asp:Label ID="OfferLabel" runat="server">Montant total :</asp:Label>
  </div>
  <div class="txtbx">
  <asp:TextBox ID="mMontantTextBox" runat="server" ReadOnly="True"></asp:TextBox>
  ,00$
  </div>
  </div>[/CODE] Then (when the user clicks a button), the information is backuped for the following screen:

Here is my code in codebehind C#
[CODE]private void SetPageState()
  {


mFormulairePageState.MontantContribution = mMontantTextBox.Text;

//...

  SavePageState();
  }

  public struct FormulairePageState
  { 
 
 
  public int SelectedIndex;
  //....

  public string MontantContribution;
 
  //....
 
  }  [/CODE]In the second screen, I display the sum in a "Label", mPriceLabel,!
Here is my code in codebehind C#
[CODE]private void LoadLabels()
  {
  object FormulairePageState = Session["FormulairePage"];
 
  // change the amount by adding two 00
  cost = s.MontantContribution;
  double doubleVal = 0.0;
  if (Double.TryParse(cost, out doubleVal))
  {
  newVal = (int)doubleVal * 100;
  mPriceLabel.Text = newVal.ToString(); // 1000 is displayed, I need it for credit card
 

  }
[/CODE]But in my label, mPriceLabel, there is nothing, it is empty. Comemnt I can display the sum in this screen ?
I did a test on my first screen: I removed "[ReadOnly="True"]" in my TextBox "mMontantTextBox"... Then I typed the numbers directly in the textBox, mMontantTextBox. In this case, these values ??are displayed in the label on the second screen!

Could you help me, please : Comemnt I can display the sum in 2sd screen ?


Answers (3)