protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // Temporary data fetched through a list. In production you will fetch data from the database Make make = new Make(); ddlMake.DataSource = make.GetMake(); ddlMake.DataTextField = "Name"; ddlMake.DataValueField = "Id"; ddlMake.DataBind(); if (ViewState["dt"] != null) { DataTable dt = ViewState["dt"] as DataTable; gvItems.DataSource = dt; } } }