473,320 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ajax help - populating a text field

I am not sure if this goes in here ot the ASP forum


I have been trying to get some simple AJAX on my site but its not going so well
I am not sure what my problems is what i am trying to do is populate a text field

Here is my code



--------------------------------------------------------------------------------

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="_test_Default5" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6.  
  7. <head runat="server">
  8.  
  9. <title>Untitled Page</title>
  10.  
  11. <script language="javascript" type="text/javascript">
  12.  
  13. function fadeout(text){
  14.  
  15. alert(text);
  16.  
  17. text.style.filter="blendTrans(duration=2)";
  18.  
  19. text.filters.item(0).Transition=12;
  20.  
  21. // doFilter(text)
  22.  
  23. }
  24.  
  25.  
  26. function doFilter (text) {
  27.  
  28. filterFrom.filters.item(0).Apply();
  29.  
  30. text.filters.item(0).Transition=12; // 12 IS THE DISSOLVE FILTER
  31.  
  32. text.style.visibility = "hidden";
  33.  
  34. filterTo.style.visibility = "";
  35.  
  36. filterFrom.filters.item(0).play(14);
  37.  
  38. }
  39.  
  40.  
  41. </script>
  42.  
  43. </head>
  44.  
  45. <body>
  46.  
  47. <form id="form1" runat="server">
  48.  
  49. <asp:ScriptManager ID="ScriptManager1" runat="server">
  50.  
  51. </asp:ScriptManager>
  52.  
  53.  
  54.  
  55. <asp:DropDownList ID="quataty" runat="server" AutoPostBack="True" 
  56.  
  57. onselectedindexchanged="quataty_SelectedIndexChanged" >
  58.  
  59. <asp:ListItem Value="25" Text="25"></asp:ListItem>
  60.  
  61. <asp:ListItem Value="50" Text="50"></asp:ListItem>
  62.  
  63. <asp:ListItem Value="75" Text="75"></asp:ListItem>
  64.  
  65. <asp:ListItem Value="100" Text="100"></asp:ListItem>
  66.  
  67. <asp:ListItem Value="200" Text="200"></asp:ListItem>
  68.  
  69. <asp:ListItem Value="300" Text="300"></asp:ListItem>
  70.  
  71. </asp:DropDownList>
  72.  
  73.  
  74. <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  75.  
  76. <ContentTemplate>
  77.  
  78. <asp:Label ID="total" runat="server" Text=""></asp:Label>
  79.  
  80. </ContentTemplate>
  81.  
  82. <Triggers>
  83.  
  84.  
  85. </Triggers>
  86.  
  87.  
  88. </asp:UpdatePanel>
  89.  
  90.  
  91.  
  92. <br /><br /><br /><br /><br /><br />
  93.  
  94.  
  95. <asp:Label ID="time" runat="server" Text=""></asp:Label>
  96.  
  97. </form>
  98.  
  99. </body>
  100.  
  101. </html>
  102.  
  103.  


--------------------------------------------------------------------------------


Expand|Select|Wrap|Line Numbers
  1.  
  2. using System;
  3.  
  4. using System.Collections;
  5.  
  6. using System.Configuration;
  7.  
  8. using System.Data;
  9.  
  10. using System.Web;
  11.  
  12. using System.Web.Security;
  13.  
  14. using System.Web.UI;
  15.  
  16. using System.Web.UI.HtmlControls;
  17.  
  18. using System.Web.UI.WebControls;
  19.  
  20. using System.Web.UI.WebControls.WebParts;
  21.  
  22. public partial class _test_Default5 : System.Web.UI.Page
  23.  
  24. {
  25.  
  26. protected void Page_Load(object sender, EventArgs e)
  27.  
  28. {
  29.  
  30.  
  31.  
  32. time.Text = "123";
  33.  
  34. }
  35.  
  36.  
  37.  
  38. protected void quataty_SelectedIndexChanged(object sender, EventArgs e)
  39.  
  40. {
  41.  
  42. total.Text = quataty.SelectedItem.ToString();
  43.  
  44. }
  45.  
  46. }
  47.  
  48.  
  49.  
Sep 24 '08 #1
2 1679
pronerd
392 Expert 256MB
What do you mean by "its not going so well "? What specifically is the problem? What is it doing or not doing? Errors?
Sep 25 '08 #2
Frinavale
9,735 Expert Mod 8TB
What do you mean by TextField?
Are you talking about a Label?

You need to put all of the controls that are required to perform the partial page update inside the UpdatePanel.

Therefore if you are updating the Label based on what is selected in your DropDownList you need to put both the Label and the DropDownList inside the UpdatePanel.

You have to be more specific about what is wrong and what difficulties you are facing.

-Frinny
Sep 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Frances | last post by:
I literally started learning AJAX just last weekend.. I have this page, http://www.francesdelrio.com/ajax/db2.html, where I'm essentially doing what's here,...
13
by: adam | last post by:
Hey All, I'm relatively new to all this and any help would be appreciated. What I'm aiming to do is create a few requests, to 1. Search for a Student against XML created from the database 2. If...
8
by: jd2007 | last post by:
Why the Ajax code below in ajax.js is causing my form not to work ? ajax.js: var a=0; var b=0; var c=0; var d=0; var e=0; var f=0;
3
by: sheelanv | last post by:
Hi, I have two fields in my Table - "ID" and "LastUpdate" and i want the "LastUpdate" field to be updated with the current date and time whenever i make any changes to the field "ID" or add a new...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.