protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { String[] array = new String[10]; array = ItemDataProcess.getBookByItemId(4); GridViewDataBind(); List <Category> categories = ItemDataProcess.GetCategories(); List <Publisher> publishers = ItemDataProcess.GetPublishers(); Session["PublisherData"] = publishers; Session["CategoryData"] = categories; if (Session["AuthenticatedAdminData"] != null) { FillCategories(); FillPublishers(); FillDate(); } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if ((DropDownList)e.Row.FindControl("ddlDistinctItemCategory") != null) { DropDownList DropDownList1 = (DropDownList)e.Row.FindControl("ddlDistinctItemCategory"); DropDownList1.DataSource = ItemDataProcess.GetCategories(); DropDownList1.DataTextField = "name"; DropDownList1.DataValueField = "categoryId"; DropDownList1.DataBind(); } if ((DropDownList)e.Row.FindControl("ddlDistinctItemPublisher") != null) { DropDownList DropDownList1 = (DropDownList)e.Row.FindControl("ddlDistinctItemPublisher"); DropDownList1.DataSource = ItemDataProcess.GetPublishers(); DropDownList1.DataTextField = "name"; DropDownList1.DataValueField = "publisherId"; DropDownList1.DataBind(); } } }
private void GridViewDataBind() { GridViewAdmin.DataSource = ItemDataProcess.GetPublishers(); //Görüldüğü gibi GridView’e DataSet nesnesi atanıyor. GridViewAdmin.DataBind(); //this.DataBind() değil GridView’in DataBind()’i çağrıldı }