private void InitializeMyComponents() { myDTFI = new CultureInfo(Thread.CurrentThread.CurrentCulture.Name, false).DateTimeFormat; objCampiNascostiCliente = new CampiNascostiCliente(); string[] weekdayDataKeys = { "CNC_ID_CAMPO_NASCOSTO", "CLI_ID_CLIENTE" }; GridViewCampiNascosti.DataKeyNames = weekdayDataKeys; GridViewCampiNascosti.DataBound += new EventHandler(GridViewCampiNascosti_DataBound); GridViewCampiNascosti.PageIndexChanging += new GridViewPageEventHandler(GridViewCampiNascosti_PageIndexChanging); GridViewCampiNascosti.Sorting += new GridViewSortEventHandler(GridViewCampiNascosti_Sorting); //GridViewCampiNascosti.RowCreated += new GridViewRowEventHandler(GridViewCampiNascosti.MyGridViewRowCreated); GridViewCampiNascosti.RowCommand += new GridViewCommandEventHandler(GridViewCampiNascosti_RowCommand); DropDownListRecordPagina.SelectedIndexChanged += new EventHandler(DropDownListRecordPagina_SelectedIndexChanged); }
protected void AccessData() { try { DataTable dt = new DataTable(); dt = CampiNascostiCliente.List(VWhereClause).Tables[0]; GridViewCampiNascosti.DataSource = dt; GridViewCampiNascosti.DataBind(); LabelNroRecord.InnerText = GetValueDizionarioUI("CAMPI_NASCOSTI") + " : " + dt.Rows.Count.ToString(); } catch (Exception ex) { ExceptionPolicy.HandleException(ex, "Propagate Policy"); } }
protected void GridViewCampiNascosti_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DELETE_COMMAND") { int chiave = Convert.ToInt32(e.CommandArgument); try { CampiNascostiCliente objCampiNascostiCliente = new CampiNascostiCliente(); CampiNascostiCliente.Delete(chiave); LoadDataSource(); } catch (Exception ex) { ExceptionPolicy.HandleException(ex, "Propagate Policy"); } } }
override protected void OnInit(EventArgs e) { InitializeMyComponents(); objCampiNascostiCliente = new CampiNascostiCliente(); base.OnInit(e); }