public DataGridCommandEventArgs ( DataGridItem item, object source, CommandEventArgs args) : base (args) { this.item = item; this.source = source; }
private void ConcepLiqPorUnidadVenta_DataBinding(object sender, System.EventArgs e) { SisPackController.AdministrarGrillas.Configurar(this.hgConceptos, "ConceptoLiquidacionID", 20, true, true); //if an InvalidCastException occurs in either of the next two lines, //please make sure that you've set the TemplateDataMode to Table (because you want nested grids) DataGridItem dgi = (DataGridItem)this.BindingContainer; if (!(dgi.DataItem is DataSet)) { throw new ArgumentException("Please change the TemplateDataMode attribute to 'Table' in the HierarGrid declaration"); } DataSet ds = (DataSet)dgi.DataItem; //Session["dsConcepLiq"] = ds; this.hgConceptos.DataSource = ds; this.hgConceptos.DataMember = "Conceptos"; this.hgConceptos.DataBind(); this.hgConceptos.RowExpanded.ExpandAll(); }
// ********************************************************************* // DataBindPostDetails // /// <summary> /// Handles databind for the post details, e.g. who and at what time. /// </summary> /// // ********************************************************************/ private void DataBindPostDetails(Object sender, EventArgs e) { HyperLink hyperlink; Label label; PlaceHolder postDetails = (PlaceHolder)sender; DataGridItem container = (DataGridItem)postDetails.NamingContainer; Post post = (Post)container.DataItem; DateTime postDate; // Construct post details label = new Label(); label.CssClass = "normalTextSmall"; label.Text = "Posted by "; postDetails.Controls.Add(label); // Author hyperlink = new HyperLink(); hyperlink.CssClass = "normalTextSmall"; hyperlink.Text = post.Username; hyperlink.NavigateUrl = Globals.UrlUserProfile + post.Username; postDetails.Controls.Add(hyperlink); // Posted on date postDate = post.PostDate; label = new Label(); label.CssClass = "normalTextSmall"; // Is the post an announcement if (post.IsAnnouncement) { label.Text = " <b>(Announcement)</b>"; } else if (DateTime.Now < postDate) { label.Text = " <b>(Pinned Post)</b>"; } else { label.Text = " on " + post.PostDate.ToString(); } postDetails.Controls.Add(label); }
protected void BtnPrint_Click(object sender, EventArgs e) { Button Print = (Button)sender; TableCell cell = Print.Parent as TableCell; DataGridItem item = cell.Parent as DataGridItem; string rn = item.Cells[2].Text; string rd = item.Cells[6].Text; string adn = item.Cells[4].Text; string sn = item.Cells[3].Text; string rf = item.Cells[9].Text; string dc = item.Cells[7].Text; string amt = item.Cells[5].Text; string pm = item.Cells[11].Text; string cn = item.Cells[8].Text; string cr = item.Cells[10].Text; string url = "Print_Receipt.aspx?rn=" + rn + "&rd=" + rd + "&adn=" + adn + "&cr=" + cr + "&sn=" + sn + "&rf=" + rf + "&dc=" + dc + "&amt=" + amt + "&pm=" + pm + "&cn=" + cn + ""; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "<script type='text/javascript'> window.open('" + url + "','mynewwin','width=100,height=100,toolbar=1,scrollbars=no')</script>", false); }
private void BindGrilla() { SisPackController.AdministrarGrillas.Configurar(this.dtgConceptosComisiones, "ConceptoComisionID", this.CantidadOpciones); dtgConceptosComisiones.AllowPaging = false; if (Session["dsConceptosComisiones"] == null) { IConceptoComision conceptoComision = ConceptoComisionFactory.GetConceptoComision(); this.dsConceptosComisiones = conceptoComision.GetConceptosComisionesDataSet(); } else { this.dsConceptosComisiones = (DsConceptosComisiones)Session["dsConceptosComisiones"]; if (this.dtgConceptosComisiones.EditItemIndex != -1) { DataGridItem item = this.dtgConceptosComisiones.Items[this.dtgConceptosComisiones.EditItemIndex]; DsConceptosComisiones.DatosRow dr = (DsConceptosComisiones.DatosRow) this.dsConceptosComisiones.Datos.Rows[item.DataSetIndex]; /*DropDownList ddl = (DropDownList)item.FindControl("ddlConceptoComision"); * string selValue = ddl.SelectedValue; * dr.ConceptoComisionID = selValue == "" ? 0 : Convert.ToInt32(selValue);*/ /*try * {*/ TextBox porcentaje = (TextBox)item.FindControl("txtPorcentaje"); dr.PorcentajeMaximo = porcentaje.Text != "" ? Convert.ToDouble(porcentaje.Text) : 0; TextBox importeFijo = (TextBox)item.FindControl("txtimporteFijo"); dr.ImporteFijoMaximo = importeFijo.Text != "" ? Convert.ToDouble(importeFijo.Text) : 0; /*} * catch(Exception) * { * }*/ } } Session["dsConceptosComisiones"] = this.dsConceptosComisiones; this.dtgConceptosComisiones.DataSource = this.dsConceptosComisiones; this.dtgConceptosComisiones.CurrentPageIndex = 0; this.dtgConceptosComisiones.DataBind(); }
private void Delete(DataGridItem e) { try { Label lblId = e.FindControl("lblId") as Label; var id = lblId.Text; List <SqlParameter> pars = new List <SqlParameter>(); pars.Add(new SqlParameter("@Id", id)); DBHelper.ExecuteNonQuery("sp_Category_Delete", pars); Notify.ShowAdminMessageSuccess("Đã xóa", this.Page); dtgCategory.CurrentPageIndex = 0; LoadGrid(); Response.Redirect("CategoryManager.aspx"); } catch { Response.Redirect("CategoryManager.aspx"); } }
protected void dgPriceLevels_ItemDataBound(object sender, DataGridItemEventArgs e) { DataGridItem item = e.Item; //if (item.ItemIndex > -1 && item.DataItem is PriceLevelBO) //{ // PriceLevelBO objPriceLevel = (PriceLevelBO)item.DataItem; if (item.ItemIndex > -1 && item.DataItem is PriceLevelNewBO) { PriceLevelNewBO objPriceLevel = (PriceLevelNewBO)item.DataItem; HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit"); linkEdit.Attributes.Add("qid", objPriceLevel.ID.ToString()); HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete"); linkDelete.Attributes.Add("qid", objPriceLevel.ID.ToString()); } }
protected void lnkJobId_Click(object sender, EventArgs e) { SavePreInvoice(); DataGridItem parent = (DataGridItem)((LinkButton)sender).Parent.Parent; // Hyperlink to Pricing using JobId string jobId = ((HtmlInputHidden)(parent.FindControl("hidJobId"))).Value; // If no job id don't go to job if (jobId != "0") { Response.Redirect("../job/job.aspx?wiz=true&jobId=" + jobId + "&csid=" + this.CookieSessionID); } else { txtOutput.InnerHtml = "Unable to link to the Job."; } }
private void BindDataLiteral(object sender, EventArgs e) { HtmlImage l = (HtmlImage)sender; DataGridItem container = (DataGridItem)l.NamingContainer; l.Src = srcImage; if (tooltip != "") { l.Attributes.Add("title", tooltip); } l.Style.Add("cursor", "hand"); l.Attributes.Add("onClick", commandImage.Split('$')[0] + ((DataRowView)container.DataItem)[columnName1].ToString().Replace(",", ".") + ", " + ((DataRowView)container.DataItem)[columnName2].ToString().Replace(",", ".") + ", " + ((DataRowView)container.DataItem)[columnName3].ToString().Replace(",", ".") + ", " + ((DataRowView)container.DataItem)[columnName4].ToString().Replace(",", ".") + " " + ((DataRowView)container.DataItem)[columnName5].ToString().Replace(",", ".") + " " + commandImage.Split('$')[1]); }
public void ChangeHeader(object sender, DataGridItemEventArgs e) { DataGridItem item = e.Item; if (item.ItemType == ListItemType.Header) { TableRow header = (TableRow)item; //header row header.Cells[0].Text += header.Cells[0].Text + ":)"; //modify 1st column header } if (item.ItemType == ListItemType.Footer) { TableCell footer = (TableCell)item.Controls[0]; footer.Text = "This is footer"; } if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { item.Cells[0].Text = (item.DataSetIndex + 1).ToString(); } }
protected void btncancel_Click1(object sender, EventArgs e) { Button list = (Button)sender; TableCell cell = list.Parent as TableCell; DataGridItem item = cell.Parent as DataGridItem; int index = item.ItemIndex; Button btncancel = (Button)item.FindControl("btncancel"); da = new DataAccess(); if (btncancel.Text == "Cancel Booking") { if (item.Cells[8].Text == "Approved") { strsql = "update tblbusbooking set intRCStatus=1,dtApprovedDate=getdate() where intid=" + item.Cells[0].Text; da.ExceuteSqlQuery(strsql); } } fillgrid(); }
protected void btndelete_Click(object sender, ImageClickEventArgs e) { try { ImageButton delete = (ImageButton)sender; TableCell cell = delete.Parent as TableCell; DataGridItem item = cell.Parent as DataGridItem; DataAccess da = new DataAccess(); string sql = "delete tbldriver where intid=" + item.Cells[0].Text; da.ExceuteSqlQuery(sql); Functions.UserLogs(Session["UserID"].ToString(), "tbldriver", item.Cells[0].Text, "Deleted", Session["PatronType"].ToString(), Session["SchoolID"].ToString(), 115); fillgrid(); Clear(); } catch { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Selected record cannot be deleted since it is linked to other modules')", true); } }
/// <summary> /// Caricamento dati dell'evento /// </summary> /// <param name="e"></param> private void FetchEvent(DataGridItem item) { int eventId = this.GetEventId(item); Publisher.Proxy.EventInfo eventInfo = null; if (eventId > 0) { // Caricamento dati evento selezionato eventInfo = this.GetEvent(eventId); } // Caricamento tipi oggetto this.FetchObjectTypes(item); if (eventId > 0) { // Selezione tipo oggetto DropDownList cboObjectTypes = this.GetObjectTypesDropDown(item); cboObjectTypes.SelectedValue = eventInfo.ObjectType; } // Caricamento profili oggetto this.FetchObjectTemplates(item); if (eventId > 0) { // Selezione profilo oggetto DropDownList cboObjectTemplates = this.GetObjectTemplatesDropDown(item); cboObjectTemplates.SelectedValue = eventInfo.ObjectTemplateName; } // Caricamento log oggetto this.FetchObjectLogs(item); if (eventId > 0) { // Selezione log DropDownList cboLogEvents = this.GetObjectLogsDropDown(item); cboLogEvents.SelectedValue = eventInfo.EventName; } }
public void DataBindDependentList(object Sender, System.EventArgs E) { if (((DropDownList)Sender).ID == "ddlRelatedSystem") { //Get the Shape DropDown DropDownList ddlSys = (DropDownList)Sender; int intSys = int.Parse(ddlSys.SelectedItem.Value); SqlConnection sqlConn = SMARTSConnectionOpen(); SqlCommand sqlCmd = new SqlCommand(String.Format("GetItem_Contained {0},{1},{2}", Common.TABLE_SHAPE, intSys, Common.ABSTRACTION_SYSTEMOBJECT), sqlConn); DataTable sqlTable = sqlCmd.ExecuteDataTable(sqlConn); DataGridItem item = (DataGridItem)ddlSys.Parent.Parent; DropDownList ddlShape = (DropDownList)item.FindControl("ddlRelated"); ddlShape.DataSource = sqlTable; ddlShape.DataBind(); sqlConn.Close(); } }
protected void DeleteButton_Click(object sender, EventArgs e) { DataGridItem item = default(DataGridItem); for (int i = 0; i < grdUser.Items.Count; i++) { item = grdUser.Items[i]; if (item.ItemType == ListItemType.AlternatingItem | item.ItemType == ListItemType.Item) { if (((CheckBox)item.FindControl("ChkSelect")).Checked) { string strId = item.Cells[1].Text; UsersService.UsersInfo_Delete(strId); } } } grdUser.CurrentPageIndex = 0; BindGrid(); }
private void dtgLiquidaciones_DataBinding(object sender, System.EventArgs e) { SisPackController.AdministrarGrillas.ConfigurarChica(this.dtgLiquidaciones, "LiquidacionWebDetalleID", GridLines.Both, true); //please make sure that you've set the TemplateDataMode to Table (because you want nested grids) DataGridItem dgi = (DataGridItem)this.BindingContainer; if (!(dgi.DataItem is DataSet)) { throw new ArgumentException("Please change the TemplateDataMode attribute to 'Table' in the HierarGrid declaration"); } DataSet ds = (DataSet)dgi.DataItem; dtgLiquidaciones.ShowFooter = true; dtgLiquidaciones.DataSource = ds; dtgLiquidaciones.DataMember = "GuiasLiquidadas"; //dtgLiquidaciones.DataBind(); }
protected string GetOpenModeText(DataGridItem Container) { string SSL = ""; MultiXTpmDB.LinkRow Row = (MultiXTpmDB.LinkRow)((DataRowView)Container.DataItem).Row; if (Row.SSLAPI == MultiXTpm.SSL_API.OpenSSL.ToString()) { SSL = "/" + Row.SSLAPI; } if (Row.OpenMode == (int)MultiXTpm.MultiXOpenMode.MultiXOpenModeClient) { return("Client/Connect" + SSL); } if (Row.OpenMode == (int)MultiXTpm.MultiXOpenMode.MultiXOpenModeServer) { return("Server/Listen" + SSL); } return("UnKnown"); }
protected void SelectRowField(object sender, EventArgs e) { LinkButton link = (LinkButton)sender; TableCell cell = (TableCell)link.Parent; DataGridItem dgItem = (DataGridItem)cell.Parent; if (this.selectedFieldPosition != null && !String.IsNullOrEmpty(this.selectedFieldPosition.Value) && Convert.ToInt32(this.selectedFieldPosition.Value) != dgItem.ItemIndex) { this.gridField.Items[Convert.ToInt32(this.selectedFieldPosition.Value)].Attributes.Add("onmouseout", "this.className='RowOverFirst';"); this.gridField.Items[Convert.ToInt32(this.selectedFieldPosition.Value)].CssClass = "no_selected_check"; if (!string.IsNullOrEmpty(this.hfFieldId.Value)) { SaveCurrentFieldProperties(); } } bool locked = TemporaryGrid.Fields[dgItem.ItemIndex].Locked; if (!locked) { this.txtLabel.Text = TemporaryGrid.Fields[dgItem.ItemIndex].Label; this.txtLabel.Visible = true; this.lblEtichetta.Visible = true; this.lblLarghezza.Visible = true; this.ddlWidth.Visible = true; } else { this.txtLabel.Text = string.Empty; this.txtLabel.Visible = false; this.lblEtichetta.Visible = false; this.lblLarghezza.Visible = false; this.ddlWidth.Visible = false; } this.ddlWidth.SelectedValue = (TemporaryGrid.Fields[dgItem.ItemIndex].Width).ToString(); this.gridField.Items[dgItem.ItemIndex].Attributes.Remove("onmouseout"); this.gridField.Items[dgItem.ItemIndex].CssClass = "selected_check"; EnabledButtunUpDown(dgItem); this.selectedFieldPosition.Value = (dgItem.ItemIndex).ToString(); Label systemIdLabel = (Label)this.gridField.Items[dgItem.ItemIndex].FindControl("SYSTEM_ID"); this.hfFieldId.Value = systemIdLabel.Text; this.value_fields.Update(); }
//------------------------------------------------------------------------------------------- void WeavverDataGrid_PreRender(object sender, EventArgs e) { //TemplateColumn tc = //tc. System.Web.UI.WebControls.Table tbl = (System.Web.UI.WebControls.Table)Controls[0]; for (int y = 0; y < tbl.Controls.Count; y++) { DataGridItem row = (DataGridItem)tbl.Controls[y]; //Page.Response.Write(tbl.Controls[y].GetType().ToString()); //} //for (int r = 0; r < Items.Count; r++) //{ // DataGridItem row = Items[r]; if (row.ItemType == ListItemType.Item || row.ItemType == ListItemType.AlternatingItem) { for (int i = 0; i < row.Cells.Count; i++) { TableCell cell = (TableCell)row.Cells[i]; if (!cell.Width.IsEmpty) { string div = "height:15px;"; div += "white-space:nowrap;"; div += "text-overflow:ellipsis;"; div += "overflow:hidden;"; div += "word-break:break-all;"; div += "word-wrap:break-word;"; div += "width:" + cell.Width.ToString() + ";"; //for (int x = 0; x < e.Item.Cells[x].Controls.Count; x++) //{ // Page.Response.Write(e.Item.Cells[i].Controls[i].GetType().ToString()); //} cell.Controls.AddAt(0, new LiteralControl("<div style='" + div + "'>" + cell.Text)); cell.Controls.Add(new LiteralControl("</div>")); } } } } }
/// <summary> /// Radio button clicked to choose record in the search results /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void rbChoose_CheckedChanged(object sender, EventArgs e) { RadioButton rb = (RadioButton)sender; DataGridItem dgi = (DataGridItem)rb.Parent.BindingContainer; int personID = Int32.Parse(dgPeople.Items[dgi.ItemIndex].Cells[0].Text); foreach (DataGridItem i in dgPeople.Items) { i.Style.Remove("background-color"); i.Style.Remove("border"); // Uncheck all other radio buttons ((RadioButton)i.FindControl("rbChoose")).Checked = false; } // Check the button that was clicked ((RadioButton)dgi.FindControl("rbChoose")).Checked = true; // Set the styling of the checked button to be highlighted dgPeople.Items[dgi.ItemIndex].Style.Add("background-color", "#fefebb"); dgPeople.Items[dgi.ItemIndex].Style.Add("border", "1px solid #000000"); dgPeople.Items[dgi.ItemIndex].Attributes.Remove("onmouseover"); dgPeople.Items[dgi.ItemIndex].Attributes.Remove("onmouseout"); Person p = new Person(personID); // Need to fix this so that it's in the updatepanel, so that the ajax call can update the value properly ihPersonList.Text = p.PersonID.ToString(); // Set the form focus depending on whether campus is seleted or visible, or start date has already been entered if (ddlCampus.SelectedValue.Equals("-1") && ddlCampus.Visible == true) { ddlCampus.Focus(); } else if (tbStartDate.Text == "") { tbStartDate.Focus(); } else { tbFrequencyCount.Focus(); } }
// Callback do dropdownlist de seleção: aloca um recurso e atualiza os componentes na tela protected void ddlDisponiveis_SelectedIndexChanged(object sender, EventArgs e) { //FIXME: tratar possíveis problemas de conexão com o servidor e solicitação de recurso indisponível. DropDownList ddlDisponiveis = (DropDownList)sender; string recString = ddlDisponiveis.SelectedValue; TableCell cell = (TableCell)ddlDisponiveis.Parent; DataGridItem grid = (DataGridItem)cell.Parent; string dataString = ((Label)grid.FindControl("lblData")).Text; string horario = ((Label)grid.FindControl("lblHora")).Text; string aulaString = ((Label)grid.FindControl("lblAulaId")).Text; alocar(recString, dataString, horario, aulaString); AtualizaComponentes(grid, dataString, horario, aulaString); Dictionary <Guid, Tuple <Guid, Guid> > blocks = (Dictionary <Guid, Tuple <Guid, Guid> >)Application["blocks"]; Tuple <Guid, Guid> bloqueados = null; Guid key = new Guid(ddlDisponiveis.SelectedValue); // Remove recurso do dropdown de seleção ddlDisponiveis.Items.Remove(ddlDisponiveis.Items.FindByValue(ddlDisponiveis.SelectedValue)); // Se esse recurso bloqueia algum(s) outro(s), retira do dropdown tambem if (blocks.ContainsKey(key)) { bloqueados = blocks[key]; if (bloqueados.Item1 != Guid.Empty) { ddlDisponiveis.Items.Remove(ddlDisponiveis.Items.FindByValue(bloqueados.Item1.ToString())); } if (bloqueados.Item2 != Guid.Empty) { ddlDisponiveis.Items.Remove(ddlDisponiveis.Items.FindByValue(bloqueados.Item2.ToString())); } } ddlDisponiveis.SelectedIndex = 0; // E atualiza o BD com as alteracoes na grade AtualizaTodaGrade(); }
protected void ddlETMM_SelectedIndexChanged(object sender, EventArgs e) { DropDownList list = (DropDownList)sender; TableCell cell = list.Parent as TableCell; DataGridItem item = cell.Parent as DataGridItem; int index = item.ItemIndex; DropDownList dlhh = new DropDownList(); DropDownList dlmm = new DropDownList(); dlhh = (DropDownList)item.FindControl("ddlETHH"); dlmm = (DropDownList)item.FindControl("ddlETMM"); if (DateTime.Parse(item.Cells[1].Text) > DateTime.Parse(dlhh.SelectedValue + ":" + dlmm.SelectedValue)) { //lblerror.Text = "Invalid Time!"; } else { ///lblerror.Text = ""; DataAccess da = new DataAccess(); string str = "select intid from tblschoolperiodstemp where intschool=" + item.Cells[5].Text + " and intorder=" + item.Cells[4].Text + "+1"; ds = da.ExceuteSql(str); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Functions.UserLogs(Session["UserID"].ToString(), "tblschoolperiodstemp", ds.Tables[0].Rows[0]["intid"].ToString(), "Updated", Session["PatronType"].ToString(), Session["SchoolID"].ToString(), 325); } } str = "update tblschoolperiodstemp set strSTHH='" + dlhh.SelectedValue + "',strSTMM='" + dlmm.SelectedValue + "' where intschool=" + item.Cells[5].Text + " and intorder=" + item.Cells[4].Text + "+1"; da.ExceuteSqlQuery(str); da = new DataAccess(); str = "update tblschoolperiodstemp set strETHH='" + dlhh.SelectedValue + "',strETMM='" + dlmm.SelectedValue + "' where intid=" + item.Cells[3].Text; Functions.UserLogs(Session["UserID"].ToString(), "tblschoolperiodstemp", item.Cells[3].Text, "Updated", Session["PatronType"].ToString(), Session["SchoolID"].ToString(), 325); da.ExceuteSqlQuery(str); filltheperiods(); } }
public void dgCategories_IsCateogrySelected(object sender, System.EventArgs e) { try { CheckBox chkIsCategorySelected = (CheckBox)sender; DataGridItem item = (DataGridItem)chkIsCategorySelected.Parent.Parent; clsBLSubCategoryAssignment objClsBLSubCategoryAssignment = new clsBLSubCategoryAssignment(); clsSubCategoryAssignment objClsSubCategoryAssignment = new clsSubCategoryAssignment(); DataSet dsAdminSubCategories = objClsBLSubCategoryAssignment.getSubCategories(); if (((CheckBox)item.FindControl("chkBoxCategory")).Text == "Admin") { if (chkIsCategorySelected.Checked == false) { RemoveAllAdmin(); } } else if (((CheckBox)item.FindControl("chkBoxCategory")).Text == "IT") { if (chkIsCategorySelected.Checked == false) { RemoveAllIT(); } } else if (((CheckBox)item.FindControl("chkBoxCategory")).Text == "HR") { if (chkIsCategorySelected.Checked == false) { RemoveAllHR(); } } } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "SubCategoryAssignment.aspx", "dgCategories_IsCateogrySelected", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
protected void ImageCreatedRender(Object sender, DataGridItemEventArgs e) { ImageButton imgDelete = (ImageButton)e.Item.FindControl("btn_Rimuovi"); ImageButton imgDettaglio = (ImageButton)e.Item.FindControl("btn_dettagli"); //Andrea System.Web.UI.WebControls.Image imgErrore = (System.Web.UI.WebControls.Image)e.Item.FindControl("img_errore"); if (imgDettaglio != null) { TableCell cell = (TableCell)imgDettaglio.Parent; DataGridItem dgItem = (DataGridItem)cell.Parent; Label a = (Label)dgItem.FindControl("PERC"); if (a != null && !string.IsNullOrEmpty(a.Text) && a.Text.Equals("100%")) { imgDettaglio.Visible = true; imgDettaglio.Attributes.Add("onmouseover", "this.src='../../images/proto/dett_lente_doc_up.gif'"); imgDettaglio.Attributes.Add("onmouseout", "this.src='../../images/proto/dett_lente_doc.gif'"); if (imgDelete != null) { imgDelete.Visible = true; imgDelete.Attributes.Add("onmouseover", "this.src='../../images/ricerca/cancella_griglia_hover.gif'"); imgDelete.Attributes.Add("onmouseout", "this.src='../../images/ricerca/cancella_griglia.gif'"); } //Andrea if (imgErrore != null) { imgErrore.Visible = true; } } } if (e.Item.ItemType == ListItemType.Pager) { if (e.Item.Cells.Count > 0) { e.Item.Cells[0].Attributes.Add("colspan", e.Item.Cells[0].ColumnSpan.ToString()); } } }
public void BadTypeCopy() { DataGridItemCollection c; ArrayList list; Array copy; DataGridItem item; list = new ArrayList(); item = new DataGridItem(0, 0, ListItemType.Item); list.Add(item); item = new DataGridItem(1, 1, ListItemType.Header); list.Add(item); item = new DataGridItem(2, 2, ListItemType.Footer); list.Add(item); c = new DataGridItemCollection(list); copy = new Array[2]; c.CopyTo(copy, 0); }
protected void dtgGuiasConformadas_DataBinding(object sender, EventArgs e) { // Reviso si estoy en el evento DataBinding por que se cambio se llamo al metodo DataBind() desde el evento PageIndexChanged if (EjecutandoEventoPageIndexChanged == false) { SisPackController.AdministrarGrillas.Configurar(this.dtgGuiasConformadas, "AgenciaDestinoID", 10); //if an InvalidCastException occurs in either of the next two lines, //please make sure that you've set the TemplateDataMode to Table (because you want nested grids) DataGridItem dgi = (DataGridItem)this.BindingContainer; if (!(dgi.DataItem is DataSet)) { throw new ArgumentException("Please change the TemplateDataMode attribute to 'Table' in the HierarGrid declaration"); } DataSet ds = (DataSet)dgi.DataItem; dtgGuiasConformadas.DataSource = ds; Session[SESSIONKEY_DATASOURCE] = ds; dtgGuiasConformadas.DataMember = "GuiasConformadas"; dtgGuiasConformadas.DataBind(); } }
public void Defaults() { DataGridItemCollection c; ArrayList list; DataGridItem item; list = new ArrayList(); item = new DataGridItem(0, 0, ListItemType.Item); list.Add(item); c = new DataGridItemCollection(list); Assert.AreEqual(1, c.Count, "D1"); Assert.AreEqual(item, c[0], "D2"); // Copy or ref? item = new DataGridItem(1, 1, ListItemType.Header); list.Add(item); Assert.AreEqual(2, c.Count, "D3"); Assert.AreEqual(ListItemType.Header, c[1].ItemType, "D4"); }
protected void delRow() { DataTable dataTable = (DataTable)this.ViewState["ResourcesTable"]; if (this.grdDetail.Items.Count > 0) { for (int i = this.grdDetail.Items.Count - 1; i >= 0; i--) { DataGridItem dataGridItem = this.grdDetail.Items[i]; CheckBox checkBox = (CheckBox)dataGridItem.FindControl("chkBox"); if (checkBox.Checked) { dataTable.Rows.RemoveAt(dataGridItem.ItemIndex); } } this.ViewState["ResourcesTable"] = dataTable; this.grdDetail.DataSource = (DataTable)this.ViewState["ResourcesTable"]; this.grdDetail.DataBind(); } }
/// ----------------------------------------------------------------------------- /// <summary> /// This method is responsible for taking in posted information from the grid and /// persisting it to the property definition collection /// </summary> /// ----------------------------------------------------------------------------- private void ProcessPostBack() { string[] newOrder = ClientAPI.GetClientSideReorder(grdProfileProperties.ClientID, Page); for (int i = 0; i <= grdProfileProperties.Items.Count - 1; i++) { DataGridItem dataGridItem = grdProfileProperties.Items[i]; ProfilePropertyDefinition profileProperty = ProfileProperties[i]; CheckBox checkBox = (CheckBox)dataGridItem.Cells[COLUMN_REQUIRED].Controls[0]; profileProperty.Required = checkBox.Checked; checkBox = (CheckBox)dataGridItem.Cells[COLUMN_VISIBLE].Controls[0]; profileProperty.Visible = checkBox.Checked; } //assign vieworder for (int i = 0; i <= newOrder.Length - 1; i++) { ProfileProperties[Convert.ToInt32(newOrder[i])].ViewOrder = i; } ProfileProperties.Sort(); }
protected string GetSoftwareVersions(DataGridItem Container) { MultiXTpmDB.ProcessStatusRow Row; if (Container.DataItem is DataRowView) { Row = (MultiXTpmDB.ProcessStatusRow)((DataRowView)Container.DataItem).Row; } else { Row = (MultiXTpmDB.ProcessStatusRow)Container.DataItem; } string Ver = ""; if (!Row.IsAppVersionNull()) { Ver += Row.AppVersion; } Ver += " (" + Row.MultiXVersion + ")"; return(Ver); }
private void LoadItemValues(DataGridItem grdItem, out string id, out string type, out bool flagComp, out bool flagCC) { id = grdItem.Cells[COL_ID].Text; type = grdItem.Cells[COL_TYPE].Text; flagComp = false; flagCC = false; RadioButton optComp = grdItem.Cells[COL_COMP].FindControl("optComp") as RadioButton; RadioButton optCC = grdItem.Cells[COL_CC].FindControl("optCC") as RadioButton; if (optComp != null && optCC != null && optComp.Visible && optCC.Visible) { flagComp = optComp.Checked; flagCC = optCC.Checked; } }
public void SplitTableHeader(DataGridItem targetHeader, string newHeaderNames) { TableCellCollection cells = targetHeader.Cells; cells.Clear(); int rowCount = this.GetRowCount(newHeaderNames); int colCount = this.GetColCount(newHeaderNames); string[,] columnList = this.ConvertList(newHeaderNames, rowCount, colCount); int num3 = 0; int num4 = 0; for (int i = 0; i < rowCount; i++) { string currName = ""; for (int j = 0; j < colCount; j++) { string str2; string[] strArray3; int num9; if ((currName == columnList[j, i]) && (i != (rowCount - 1))) { currName = columnList[j, i]; } else { currName = columnList[j, i]; switch (this.IsVisible(columnList, i, j, currName)) { case -1: strArray3 = currName.Split(new char[] { ',' }); num9 = 0; goto Label_018A; case 1: num3 = this.GetSpanRowCount(columnList, rowCount, i, j); num4 = this.GetSpanColCount(columnList, rowCount, colCount, i, j); cells.Add(new TableHeaderCell()); cells[cells.Count - 1].RowSpan = num3; cells[cells.Count - 1].ColumnSpan = num4; cells[cells.Count - 1].HorizontalAlign = HorizontalAlign.Center; cells[cells.Count - 1].Text = currName; break; } } continue; Label_0148: str2 = strArray3[num9]; cells.Add(new TableHeaderCell()); cells[cells.Count - 1].HorizontalAlign = HorizontalAlign.Center; cells[cells.Count - 1].Text = str2; num9++; Label_018A: if (num9 < strArray3.Length) { goto Label_0148; } } if (i != (rowCount - 1)) { cells[cells.Count - 1].Text = cells[cells.Count - 1].Text + "</th></tr><tr class=\"" + targetHeader.CssClass + "\">"; } } }
private void SetNetInfo(DataGridItem editItem) { CheckBoxList CheckBoxListServerFlag = DataGridNet.Items[DataGridNet.EditItemIndex].Cells[3].FindControl("CheckBoxListNetFlag") as CheckBoxList; MapNode selNode = GetMapNode(int.Parse(editItem.Cells[0].Text), _netList); if (selNode != null) { CreateFlagCheckBoxList(CheckBoxListServerFlag, selNode.Flag); } else { CreateFlagCheckBoxList(CheckBoxListServerFlag, 0); } }
private void SetRegionInfo(DataGridItem editItem) { DropDownList DropDownListNet = editItem.Cells[1].FindControl("DropDownListNet") as DropDownList; CheckBoxList CheckBoxListRegionFlag = editItem.Cells[4].FindControl("CheckBoxListRegionFlag") as CheckBoxList; TextBox TextBoxRegionName = editItem.Cells[2].Controls[0] as TextBox; MapNode selNode = GetMapNode(int.Parse(editItem.Cells[0].Text), _netList); if (selNode != null) { CreateDropDownListNet(DropDownListNet); //选择Net和Region DropDownListNet.SelectedIndex = -1; foreach (ListItem item in DropDownListNet.Items) { if (int.Parse(item.Value) == selNode.Parent.ID) { item.Selected = true; break; } } CreateFlagCheckBoxList(CheckBoxListRegionFlag, selNode.Flag); TextBoxRegionName.Text = selNode.Name; } else { CreateDropDownListNet(DropDownListNet); CreateFlagCheckBoxList(CheckBoxListRegionFlag, 0); TextBoxRegionName.Text = "Name"; } }
private void SetInfo(DataGridItem editItem) { DropDownList DropDownListNet = editItem.Cells[1].FindControl("DropDownListNetEdit") as DropDownList; DropDownList DropDownListRegion = editItem.Cells[2].FindControl("DropDownListRegionEdit") as DropDownList; Common_ServerGroupDropDownList DropDownListServerGroup = editItem.Cells[6].FindControl("DropDownListServerGroup") as Common_ServerGroupDropDownList; Common_ServerDropDownList DropDownListServer = editItem.Cells[6].FindControl("DropDownListServer") as Common_ServerDropDownList; CheckBoxList CheckBoxListServerFlag = editItem.Cells[5].FindControl("CheckBoxListServerFlag") as CheckBoxList; MapNode serverNode = GetMapNode(int.Parse(editItem.Cells[0].Text), _netList); if (serverNode != null) { CreateDropDownListNet(DropDownListNet); //选择Net和Region DropDownListNet.SelectedIndex = -1; foreach (ListItem item in DropDownListNet.Items) { if (int.Parse(item.Value) == serverNode.Parent.Parent.ID) { item.Selected = true; break; } } CreateDropDownListRegion(DropDownListRegion, serverNode.Parent.Parent); DropDownListRegion.SelectedIndex = -1; foreach (ListItem item in DropDownListRegion.Items) { if (int.Parse(item.Value) == serverNode.Parent.ID) { item.Selected = true; break; } } //Server GameServer server = TheAdminServer.GameServerManager.GetGameServer(serverNode.MapServerId); if (server != null) { DropDownListServerGroup.Refresh(); DropDownListServerGroup.SelectedServerGroup = server.Group; DropDownListServer.CreateServerList(server.Group, GameServer.ServerType.bishop); DropDownListServer.SelectedGameServer = server; } CreateFlagCheckBoxList(CheckBoxListServerFlag, serverNode.Flag); SetFlagCheckBoxListByGroupEnabled(CheckBoxListServerFlag, TheAdminServer.GameServerManager.GetGameServer(serverNode.MapServerId).Group); } else { CreateDropDownListNet(DropDownListNet); CreateDropDownListRegion(DropDownListRegion, int.Parse(DropDownListNet.SelectedValue)); DropDownListServerGroup.Refresh(); DropDownListServer.CreateServerList(DropDownListServerGroup.SelectedServerGroup, GameServer.ServerType.bishop); CreateFlagCheckBoxList(CheckBoxListServerFlag, 0); SetFlagCheckBoxListByGroupEnabled(CheckBoxListServerFlag, DropDownListServerGroup.SelectedServerGroup); } }
// Atualiza o dropdownlist de seleção de recursos e o checkbox list dos selecionados, // para uma determinada linha da tabela private void AtualizaComponentes(DataGridItem grid, String dataString, String horario, String aulaString) { CheckBoxList cbRecursos = (CheckBoxList)grid.FindControl("cbRecursos"); ImageButton butDel = (ImageButton)grid.FindControl("butDeletar"); ImageButton butTransf = (ImageButton)grid.FindControl("butTransferir"); ImageButton butTrocar = (ImageButton)grid.FindControl("butTrocar"); DateTime data = Convert.ToDateTime(dataString); AlocacaoBO alocBO = new AlocacaoBO(); List<Recurso> recAlocados = alocBO.GetRecursoAlocadoByAula(data, horario, new Guid(aulaString)); cbRecursos.Items.Clear(); if (recAlocados.Count != 0) { // Habilita botões butDel.Visible = true; butTransf.Visible = true; butTrocar.Visible = true; foreach (Recurso r in recAlocados) cbRecursos.Items.Add(new ListItem(r.Descricao, r.Id.ToString())); } else { // Desabilita botões butDel.Visible = false; butTransf.Visible = false; butTrocar.Visible = false; } }
public DataGridItemEventArgs (DataGridItem item) { this.item = item; }
// Salva os dados da linha corrente (chamados pelos eventos de select das drop down lists, etc) private void SalvaDados(DataGridItem gridItem) { // Salva dados digitados Label lblData = (Label)gridItem.FindControl("lblData"); Label lblHora = (Label)gridItem.FindControl("lblHora"); TextBox txtDescricao = (TextBox)gridItem.FindControl("txtDescricao"); DropDownList ddlAtividade = (DropDownList)gridItem.FindControl("ddlAtividade"); Label lblCorDaData = (Label)gridItem.FindControl("lblCorDaData"); Label lblDescData = (Label)gridItem.FindControl("lblDescData"); Label lblaulaId = (Label)gridItem.FindControl("lblAulaId"); Guid idaula = new Guid(lblaulaId.Text); Guid idturma = (Guid)Session["TurmaId"]; Turma turma = turmaBo.GetTurmaById(idturma); string hora = lblHora.Text; DateTime data = Convert.ToDateTime(lblData.Text); string aux = txtDescricao.Text; string descricao = aux.Substring(aux.IndexOf('\n') + 1); Guid idcategoria = new Guid(ddlAtividade.SelectedValue); CategoriaAtividade categoria = categoriaBo.GetCategoriaAtividadeById(idcategoria); if (gridItem.BackColor != Color.LightGray && lblCorDaData.Text.Equals("False")) gridItem.BackColor = categoria.Cor; Aula aula = Aula.GetAula(idaula, turma, hora, data, descricao, categoria); aulaBo.UpdateAula(aula); //txtDescricao.Text = lblDescData.Text + "\n" + descricao; txtDescricao.Text = descricao; }
// Constructors public DataGridItemEventArgs(DataGridItem item) {}
// Constructors public DataGridCommandEventArgs(DataGridItem item, object commandSource, CommandEventArgs originalArgs) {}