(X) Hide this
    • Login
    • Join
      • Generate New Image
        By clicking 'Register' you accept the terms of use .

Forums

Search in:

Go

Events not fired

  • sivagirirajan
    sivagirirajan
    0 points
    0 posts
    03:10 PM
        Report Abuse

    Hi

           I am very new to .NET 4.0 , i am trying to do a small .net web application in that i have a text box, combobox, list box if i enter something in text box or what ever the control i mentioned above the text change event is not detected . which means the code inside the text change event is not fired.

     

    the code as follows

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <!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></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
        <div>
       
        </div>
        </form>
    </body>
    </html>

     

    And the C# code as follows

    using

     

     

    System;

     

    using

     

     

     

     

     

     

     

     

     

    System.Collections.Generic;

     

    using

     

     

     

     

     

     

     

     

     

    System.Linq;

     

    using

     

     

     

     

     

     

     

     

     

    System.Web;

     

    using

     

     

     

     

     

     

     

     

     

    System.Web.UI;

     

    using

     

     

     

     

     

     

     

     

     

    System.Web.UI.WebControls;

     

    public

     

     

     

     

     

     

     

     

     

    partial class _Default : System.Web.UI.Page

     

    {

     

     

     

     

     

     

    protected void Page_Load(object sender, EventArgs e)

     

    {

    TextBox1.Text =

     

     

     

     

     

     

    "Welcome to my new site";

     

    }

     

     

     

     

     

     

    protected void TextBox1_TextChanged(object sender, EventArgs e)

     

    {

    Response.Write(TextBox1.Text);

    }

    }

     

    Reply

All Posts

  • tbmihailov
    Todor Mihaylov
    7 points
    2 posts
    06:09 PM
            Report Abuse

    Hi sivagirirajan ,

    As I see you are building an asp.net web forms application. You have to set AutoPostBack of the textbox field to true.

    <asp:TextBox runat="server" ontextchanged="Unnamed1_TextChanged" 
    		style="height22px" AutoPostBack="True"/>

    If you are new to .Net and web programming it's better to start with ASP.NET MVC(http://asp.net/mvc)


    Reply
Page  
  • 1

To reply to this thread you must Log In to your account


Thread


Tags: 
  • Asked
    459 days ago
  • Viewed
    343
  • Last Activity
    459 days ago

Related Threads


Shortcuts