1
Reply

Gridview

Ask a question
Jagjit Saini

Jagjit Saini

13y
1.3k
1
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)
Next Recommended Forum