Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
hi,
i am trying to bind gridview on DDL SelectedIndexChanged event.
but grid is not bind.
query is perfect working in sql server.No compilation error.
i am using three layer code.

code is as follow.
.cs file--

C#
protected void ddlRange_SelectedIndexChanged(object sender, EventArgs e)
    {

        BindGrid(ddlRange.SelectedValue.ToString());
            


    }

protected void BindGrid(string Language)
   {
       try
       {

           GridView1.DataSource = objMain.Selectinfo(Convert.ToInt32(Session["RANGE_ID"].ToString()));
           GridView1.DataBind();

       }
       catch (Exception ex)
       {
       }
       finally
       {


       }

   }

class file code--

C#
public DataTable Selectinfo(int RANGE_ID)
        {
            ArrayList lstParam = new System.Collections.ArrayList();
            SqlParameter param;
            param = new SqlParameter();
            param.ParameterName = "@RANGE_ID";
            param.SqlDbType = SqlDbType.Int;
            param.Value = RANGE_ID;
            lstParam.Add(param);

            return (new ConnectivityStatusDAL.SQLDAL().SelectData("SP_SelectIinfo", lstParam, false));
        }


whats going wrong please help.
thanks
Posted
Updated 16-Jul-13 1:09am
v2
Comments
Sanjay K. Gupta 16-Jul-13 7:11am    
Have you checked "AutoPostBack" property of Dropdownlist. It should "True"

1 solution

Check the "AutoPostBack" property for your Dropdownlist. It must be true to trigger the ddlRange_SelectedIndexChanged event. For more details check the following link.

http://asp-net-example.blogspot.in/2009/03/how-to-use-dropdownlist-autopostback.html[^]

Hope it useful.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900