Jagjit Saini

Jagjit Saini

  • NA
  • 166
  • 0

Gridview

Jul 20 2011 9:05 AM
Hi


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        nsBll.CouBll pBAL = new nsBll.CouBll();
        List<nsBo.clscouprp> dataSource = pBAL.disp_rec();
        lstcountry.DataSource = dataSource;
        lstcountry.DataTextField = "p_counam";
        lstcountry.DataValueField = "p_coucod";
        lstcountry.DataBind();


    }

    protected void lstcountry_SelectedIndexChanged(object sender, EventArgs e)
    {
        
        string qry = "select * from tbl_office where countrycode = '" + lstcountry.SelectedValue + "'";
       
        SqlDataAdapter da = new SqlDataAdapter(qry, ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
        DataSet ds = new DataSet();
        da.Fill(ds);
        grdlocation.DataSource = ds;
        grdlocation.DataBind();
    }
   
}


In List coountry country names are displayed like Australia , India & their codes are AU,IN. what i have written in lstcountry_selectedindexchanged it does not show any record in Gridvew .

Thanks

Answers (1)