ajax help - populating a text field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Moiseszaragoza
    New Member
    • Feb 2007
    • 5

    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



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

    Code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="_test_Default5" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head runat="server">
    
    <title>Untitled Page</title>
    
    <script language="javascript" type="text/javascript">
    
    function fadeout(text){
    
    alert(text);
    
    text.style.filter="blendTrans(duration=2)";
    
    text.filters.item(0).Transition=12;
    
    // doFilter(text)
    
    }
    
    
    function doFilter (text) {
    
    filterFrom.filters.item(0).Apply();
    
    text.filters.item(0).Transition=12; // 12 IS THE DISSOLVE FILTER
    
    text.style.visibility = "hidden";
    
    filterTo.style.visibility = "";
    
    filterFrom.filters.item(0).play(14);
    
    }
    
    
    </script>
    
    </head>
    
    <body>
    
    <form id="form1" runat="server">
    
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    
    </asp:ScriptManager>
    
    
    
    <asp:DropDownList ID="quataty" runat="server" AutoPostBack="True" 
    
    onselectedindexchanged="quataty_SelectedIndexChanged" >
    
    <asp:ListItem Value="25" Text="25"></asp:ListItem>
    
    <asp:ListItem Value="50" Text="50"></asp:ListItem>
    
    <asp:ListItem Value="75" Text="75"></asp:ListItem>
    
    <asp:ListItem Value="100" Text="100"></asp:ListItem>
    
    <asp:ListItem Value="200" Text="200"></asp:ListItem>
    
    <asp:ListItem Value="300" Text="300"></asp:ListItem>
    
    </asp:DropDownList>
    
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    
    <ContentTemplate>
    
    <asp:Label ID="total" runat="server" Text=""></asp:Label>
    
    </ContentTemplate>
    
    <Triggers>
    
    
    </Triggers>
    
    
    </asp:UpdatePanel>
    
    
    
    <br /><br /><br /><br /><br /><br />
    
    
    <asp:Label ID="time" runat="server" Text=""></asp:Label>
    
    </form>
    
    </body>
    
    </html>


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


    Code:
    using System;
    
    using System.Collections;
    
    using System.Configuration;
    
    using System.Data;
    
    using System.Web;
    
    using System.Web.Security;
    
    using System.Web.UI;
    
    using System.Web.UI.HtmlControls;
    
    using System.Web.UI.WebControls;
    
    using System.Web.UI.WebControls.WebParts;
    
    public partial class _test_Default5 : System.Web.UI.Page
    
    {
    
    protected void Page_Load(object sender, EventArgs e)
    
    {
    
    
    
    time.Text = "123";
    
    }
    
    
    
    protected void quataty_SelectedIndexChanged(object sender, EventArgs e)
    
    {
    
    total.Text = quataty.SelectedItem.ToString();
    
    }
    
    }
  • pronerd
    Recognized Expert Contributor
    • Nov 2006
    • 392

    #2
    What do you mean by "its not going so well "? What specifically is the problem? What is it doing or not doing? Errors?

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      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

      Comment

      Working...