autopostback problem listbox asp.net
<p>I want to add posts(question) like i do that on yahoo answers.When i choose item in "kategorije" control,items can't be loaded in "SUB_kategorije" control.</p>

<p><a href="http://img28.imageshack.us/img28/6100/listbox.jpg" rel="nofollow">Image</a></p>

<p>My new ascx.cs:</p>

<pre><code>   1. protected void Page_Load(object sender, EventArgs e)  
   2.    {  
   3.   
   4.   
   5.        if (!Page.IsPostBack)  
   6.        {  
   7.   
   8.            SqlDataSource ds = new SqlDataSource();  
   9.            ds.ConnectionString = conn;  
  10.            ds.SelectCommand = "SELECT [ID], [Kategorije] FROM [kategorije] ";  
  11.            kategorije.DataSource = ds;  
  12.            kategorije.DataTextField = "Kategorije";  
  13.            kategorije.DataValueField = "ID";  
  14.            kategorije.DataBind();  
  15.            kategorije.SelectedIndex = 1;  
  16.   
  17.            SqlDataSource dk = new SqlDataSource();  
  18.            dk.ConnectionString = conn;  
  19.            dk.SelectCommand = "SELECT * from pod_kategorije WHERE kat_id = " + kategorije.SelectedItem.Value;  
  20.            SUB_kategorije.DataSource = dk;  
  21.            SUB_kategorije.DataTextField = "pkategorija";  
  22.            SUB_kategorije.DataValueField = "ID";  
  23.            SUB_kategorije.DataBind();  
  24.   
  25.   
  26.        }  
  27.         
  28.   
  29.          
  30.   
  31.    }  
  32.    protected void kategorije_SelectedIndexChanged(object sender, EventArgs e)  
  33.    {  
  34.      
  35.              
  36.            SqlDataSource dk = new SqlDataSource();  
  37.            dk.ConnectionString = conn;  
  38.            dk.SelectCommand = "SELECT * from pod_kategorije WHERE [kat_id] = " + kategorije.SelectedItem.Value;  
  39.            SUB_kategorije.DataSource = dk;  
  40.            SUB_kategorije.DataTextField = "pkategorija";  
  41.            SUB_kategorije.DataValueField = "ID";  
  42.            SUB_kategorije.DataBind();  
  43.   
  44.          
  45.    }  
</code></pre>

<p>and .ascx:</p>

<pre><code>1. &lt;asp:ListBox ID="kategorije" runat="server" Height="380px" CssClass="kat" AutoPostBack="true"   
   2.     
   3.    onselectedindexchanged="kategorije_SelectedIndexChanged"&gt;&lt;/asp:ListBox&gt;  
   4.   
   5. &lt;asp:Button ID="Button1" CssClass="posalji" runat="server" Text="click"   
   6.            onclick="Button1_Click" /&gt;  
   7.   
   8.   
   9.      
  10.    &lt;asp:UpdatePanel ID="UpdatePanel10" runat="server"&gt;  
  11.    &lt;ContentTemplate&gt; &lt;asp:ListBox ID="SUB_kategorije" CssClass="pod"  Height="150px"    runat="server"&gt;&lt;/asp:ListBox&gt;&lt;/ContentTemplate&gt;  
  12.       &lt;Triggers&gt;  
  13.       &lt;asp:AsyncPostBackTrigger ControlID="kategorije" EventName="SelectedIndexChanged" /&gt;  
  14.         
  15.       &lt;/Triggers&gt;  
  16.         
  17.    &lt;/asp:UpdatePanel&gt;  
</code></pre>
