Asp.net Dropdownlist selected index changed AND TextChanged Events not Fire? (C#)
<p>I am new to ASP>NET(C#). But I am using Winform before.</p>

<p>In my Project I have two dropdown list. if i change the one,.. the second will change auto.</p>

<p>But even event also not firing in ASP.net. Without event how to i manage that?.</p>

<pre><code>&lt;div id="Div1" class="ui-content ui-body-a" runat="server"&gt;
    &lt;asp:dropdownlist id="ddlOutlet" runat="server" autopostback="True" onselectedindexchanged="ddlOutlet_SelectedIndexChanged"
        ontextchanged="ddlOutlet_TextChanged"&gt;
                &lt;/asp:dropdownlist&gt;
    &lt;br /&gt;
    &lt;asp:dropdownlist id="ddlServedAt" runat="server"&gt;
                &lt;/asp:dropdownlist&gt;
    &lt;br /&gt;
    &lt;asp:button id="btnLogin" runat="server" text="LogIn" /&gt;
&lt;/div&gt;
</code></pre>

<p><strong>C#</strong></p>

<p>I already Added items in both dropdown list in page load event. But When I change the ddlOutlet selected index changed Event not firing. So I tried to TextChanged Events Also. But nothing happened. What is problem?.</p>

<p><strong>Page Load Event -</strong></p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{
    HelpingFunctions hp = new HelpingFunctions();

    string id = Request.QueryString["id"];

    MySqlConnection connection = new MySqlConnection("server=192.168.1.100;username=mcubic;password=mcs@2011$;database=mcubic;");
    string query = "SELECT c.Outlet_Master_Name,d.Fbserved_Served FROM mcs_user a, mcs_user_outlet b,outlet_master c,fb_served d WHERE a.Mcs_User_Id='" + id + "' and"
                    + " a.Mcs_User_Id = b.Mcs_User_Outlet_User_Id and c.Outlet_Master_Id = b.Mcs_User_Outlet_Outlet_Id and c.Outlet_Master_Id=d.Fbserved_outletid";           
    MySqlCommand command = new MySqlCommand(query, connection);
    connection.Open();
    MySqlDataReader Reader = command.ExecuteReader();
    while (Reader.Read())
    {
        ddlOutlet.Items.Add(Reader[0].ToString());
        ddlServedAt.Items.Add(Reader[1].ToString());
    }
    connection.Close();


}
</code></pre>

<p><strong>Selected Item -</strong></p>

<pre><code>protected void ddlOutlet_SelectedIndexChanged(object sender, EventArgs e)
{
    MySqlConnection connection = new MySqlConnection("server=192.168.1.100;username=mcubic;password=mcs@2011$;database=mcubic;");
    string query = "select Fbserved_Served from fb_served where Fbserved_outletid = (select Outlet_Master_Id from outlet_master where Outlet_Master_Name ='" + ddlOutlet.SelectedItem.ToString() + "')";
    MySqlCommand command = new MySqlCommand(query, connection);
    connection.Open();
    MySqlDataReader Reader = command.ExecuteReader();
    while (Reader.Read())
    {
        ddlServedAt.SelectedItem.Value = Reader[0].ToString();
    }
    connection.Close();
}
</code></pre>

<p>I read some same issue problem solutions, but they told to set AutoPostBack="True". I checked that also.</p>

<p>I don't know why ASP.net hard to Event firing also?.</p>

<p><strong>UPDATED QUESTION</strong></p>

<p>In my Project,.. I am using jquerymobile(http://jquerymobile.com/) with ASP.Net and mysql.
I have two drop down list controls and ONE button.</p>

<p>But When I change the ddlOutlet selected index changed Event not firing. After the button Click the Events Are fired Correctly. But Before that They not fire. I do't know Why its happen. </p>

<p>I Give my Complete Code Below. </p>

<p>My Complete ASPX File :-</p>

<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OutLet.aspx.cs" Inherits="MobileApp.OutLet" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
    &lt;title&gt;&lt;/title&gt;
     &lt;meta name="viewport" content="width=device-width; height=device-height; initial-scale=1.0; maximum-scale=1.5; user-scalable=no;" /&gt;
     &lt;link href="Styles/jquery.mobile-1.0b3.css" rel="stylesheet" type="text/css" /&gt;

    &lt;script src="Scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script src="Scripts/jquery-1.6.2.min.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script src="Scripts/jquery.mobile-1.0b3.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server" data-ajax="false"&gt;
        &lt;div id="mainheader" class="ui-header-fixed ui-bar-a"&gt;  

        &lt;/div&gt;
        &lt;div id="Div1" class="ui-content ui-body-a" runat="server"&gt;

           &lt;%-- &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
                &lt;ContentTemplate&gt;--%&gt;
                    &lt;asp:DropDownList ID="ddlOutlet" runat="server" 
    AutoPostBack="True" onselectedindexchanged="ddlOutlet_SelectedIndexChanged" 
    ontextchanged="ddlOutlet_TextChanged"&gt;
                    &lt;/asp:DropDownList&gt;
                    &lt;br /&gt;
                    &lt;asp:DropDownList ID="ddlServedAt" runat="server" AutoPostBack="True"&gt;
                    &lt;/asp:DropDownList&gt;
                    &lt;br /&gt;
                    &lt;asp:Button ID="btnLogin" runat="server" Text="LogIn" 
                onclick="btnLogin_Click" /&gt;
               &lt;%-- &lt;/ContentTemplate&gt;
            &lt;/asp:UpdatePanel&gt;   --%&gt;       
        &lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>my Code -</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;

namespace MobileApp
{
    public partial class OutLet : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HelpingFunctions hp = new HelpingFunctions();

            string id = Request.QueryString["id"];
            if (!Page.IsPostBack)
            {
                MySqlConnection connection = new MySqlConnection("server=192.168.1.100;username=mcubic;password=mcs@2011$;database=mcubic;");
                string query = "SELECT c.Outlet_Master_Name,d.Fbserved_Served FROM mcs_user a, mcs_user_outlet b,outlet_master c,fb_served d WHERE a.Mcs_User_Id='" + id + "' and"
                                + " a.Mcs_User_Id = b.Mcs_User_Outlet_User_Id and c.Outlet_Master_Id = b.Mcs_User_Outlet_Outlet_Id and c.Outlet_Master_Id=d.Fbserved_outletid";
                MySqlCommand command = new MySqlCommand(query, connection);
                connection.Open();
                MySqlDataReader Reader = command.ExecuteReader();
                while (Reader.Read())
                {
                    ddlOutlet.Items.Add(Reader[0].ToString());
                    ddlServedAt.Items.Add(Reader[1].ToString());
                }
                connection.Close();
            }

        }

        protected void ddlOutlet_SelectedIndexChanged(object sender, EventArgs e)
        {
            MySqlConnection connection = new MySqlConnection("server=192.168.1.100;username=mcubic;password=mcs@2011$;database=mcubic;");
            string query = "select Fbserved_Served from fb_served where Fbserved_outletid = (select Outlet_Master_Id from outlet_master where Outlet_Master_Name ='" + ddlOutlet.SelectedItem.ToString() + "')";
            MySqlCommand command = new MySqlCommand(query, connection);
            connection.Open();
            MySqlDataReader Reader = command.ExecuteReader();
            while (Reader.Read())
            {
                ddlServedAt.SelectedValue = Reader[0].ToString();
            }
            connection.Close();
        }

        protected void ddlOutlet_TextChanged(object sender, EventArgs e)
        {
            //MySqlConnection connection = new MySqlConnection("server=192.168.1.100;username=mcubic;password=mcs@2011$;database=mcubic;");
            //string query = "select Fbserved_Served from fb_served where Fbserved_outletid = (select Outlet_Master_Id from outlet_master where Outlet_Master_Name ='" + ddlOutlet.SelectedItem.ToString() + "')";
            //MySqlCommand command = new MySqlCommand(query, connection);
            //connection.Open();
            //MySqlDataReader Reader = command.ExecuteReader();
            //while (Reader.Read())
            //{
            //    ddlServedAt.SelectedItem.Value = Reader[0].ToString();
            //}
            //connection.Close();
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {

        }
    }
}
</code></pre>
