protected override object CreateControlCore() { var button = new ASPxButton {Text = Caption}; button.Click += (sender, args) => InvokeExecuted(args); return button; }
protected override ASPxButton[] GetChildButtons() { ASPxButton[] buttons = new ASPxButton[] { btnDismissAll, btnDismiss, btnSnooze }; return(buttons); }
void PrepareChildControls() { AppointmentFormTemplateContainer container = (AppointmentFormTemplateContainer)Parent; ASPxScheduler control = container.Control; AppointmentRecurrenceForm1.EditorsInfo = new EditorsInfo(control, control.Styles.FormEditors, control.Images.FormEditors); ASPxEditBase[] edits = new ASPxEditBase[] { lblSubject, tbSubject, lblLocation, tbLocation, lblLabel, edtLabel, lblStartDate, edtStartDate, lblEndDate, edtEndDate, lblStatus, edtStatus, lblAllDay, chkAllDay, lblResource, edtResource, tbDescription }; foreach (ASPxEditBase edit in edits) { edit.ParentSkinOwner = control; edit.ParentStyles = control.Styles.FormEditors; edit.ParentImages = control.Images.FormEditors; } ASPxButton[] buttons = new ASPxButton[] { btnOk, btnCancel, btnDelete }; foreach (ASPxButton button in buttons) { button.ParentSkinOwner = control; button.ControlStyle.CopyFrom(control.Styles.FormButton); } }
protected virtual WebControl CreateCentredText() { Table table = new Table(); TableRow row = new TableRow(); TableCell cell = new TableCell(); table.Rows.Add(row); row.Cells.Add(cell); cell.Controls.Add(new LiteralControl(string.Format("<div id=\"SuccessText\">{0}</div>", SuccessText))); cell.Controls.Add(new LiteralControl(" ")); ASPxButton buttonSendNewMsg = new ASPxButton(); buttonSendNewMsg.ID = "ButtonSendNewMsg"; buttonSendNewMsg.RenderMode = ButtonRenderMode.Link; buttonSendNewMsg.Text = "More Feedback"; cell.Controls.Add(buttonSendNewMsg); table.Height = Unit.Percentage(100); table.Width = Unit.Percentage(100); table.BorderWidth = Unit.Pixel(0); cell.VerticalAlign = VerticalAlign.Middle; cell.HorizontalAlign = HorizontalAlign.Center; return(table); }
protected override ASPxButton[] GetChildButtons() { ASPxButton[] buttons = new ASPxButton[] { btnOk, btnCancel, btnDelete }; return(buttons); }
public ParametrizedActionDateRangeControl(ActionContainerOrientation orientation) { _button = RenderHelper.CreateASPxButton(); _button.AutoPostBack = false; _button.Click += button_Click; _button.EnableClientSideAPI = true; _button.ID = "B"; Control editor = CreateEditorBody(); editor.ID = "Ed"; label = RenderHelper.CreateASPxLabel(); label.ID = "L"; label.Wrap = DevExpress.Utils.DefaultBoolean.False; Table table = RenderHelper.CreateTable(); table.CssClass = "ParametrizedActionControl"; table.ID = "T"; labelCell = new TableCell(); TableCell editorCell = new TableCell(); TableCell buttonCell = new TableCell(); FillTemplateTable(orientation, table, labelCell, editorCell, buttonCell); labelCell.Controls.Add(label); labelCell.CssClass = "ControlCaption"; editorCell.Controls.Add(editor); editorCell.CssClass = "Label"; buttonCell.Controls.Add(_button); buttonCell.CssClass = "Editor"; Controls.Add(table); }
protected void grid_Export_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { if (this.grid_Export.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = this.grid_Export.FindEditFormTemplateControl("pageControl_Hbl") as ASPxPageControl; ASPxTextBox custName = this.grid_Export.FindEditFormTemplateControl("txtCust") as ASPxTextBox; custName.Text = EzshipHelper.GetPartyName(this.grid_Export.GetRowValues(this.grid_Export.EditingRowVisibleIndex, new string[] { "CustomerId" })); ASPxTextBox rN = this.grid_Export.FindEditFormTemplateControl("txtRefNo") as ASPxTextBox; ASPxTextBox jN = this.grid_Export.FindEditFormTemplateControl("txtHouseNo") as ASPxTextBox; ShowAwb(rN.Text.Trim(), jN.Text.Trim()); int oid = SafeValue.SafeInt(this.grid_Export.GetRowValues(this.grid_Export.EditingRowVisibleIndex, new string[] { "Id" }), 0); if (oid > 0) { string sql = string.Format("select StatusCode from air_job where Id={0}", oid); ASPxButton btn_VoidHawb = this.grid_Export.FindEditFormTemplateControl("btn_VoidHawb") as ASPxButton; string jobStatus = SafeValue.SafeString(Manager.ORManager.ExecuteScalar(sql)); if (jobStatus == "CNL") { btn_VoidHawb.Text = "Unvoid"; } else { btn_VoidHawb.Text = "Void"; } } } }
protected virtual WebControl CreateCentredText() { Table table = new Table(); TableRow row = new TableRow(); TableCell cell = new TableCell(); table.Rows.Add(row); row.Cells.Add(cell); ASPxLabel lblSuccess = new ASPxLabel(); lblSuccess.ID = "lblSuccess"; lblSuccess.Text = "Record Saved Successfuly ."; cell.Controls.Add(lblSuccess); cell.Controls.Add(new LiteralControl(" ")); cell.Controls.Add(new LiteralControl("<br/>")); ASPxButton buttonSendNewMsg = new ASPxButton(); buttonSendNewMsg.ID = "ButtonSendNewMsg"; buttonSendNewMsg.RenderMode = ButtonRenderMode.Link; buttonSendNewMsg.Text = "New Customer Item"; cell.Controls.Add(buttonSendNewMsg); table.Height = Unit.Percentage(100); table.Width = Unit.Percentage(100); table.BorderWidth = Unit.Pixel(0); cell.VerticalAlign = VerticalAlign.Middle; cell.HorizontalAlign = HorizontalAlign.Center; return(table); }
protected override ASPxButton[] GetChildButtons() { ASPxButton[] buttons = new ASPxButton[] { btnSave, btnCancel, btnEditForm }; return buttons; }
protected override ASPxButton[] GetChildButtons() { ASPxButton[] buttons = new ASPxButton[] { btnOk, btnCancel }; return buttons; }
protected void buttonNext_Init(object sender, EventArgs e) { ASPxButton button = sender as ASPxButton; GridViewDataItemTemplateContainer container = button.NamingContainer as GridViewDataItemTemplateContainer; button.ClientSideEvents.Click = string.Format("function(s, e){{ gridView.StartEditRow({0}+1); }}", container.VisibleIndex); }
protected void ASPxButton1_Init(object sender, EventArgs e) { ASPxButton button = (ASPxButton)sender; GridViewDataRowTemplateContainer templateContainer = (GridViewDataRowTemplateContainer)button.NamingContainer; button.ClientSideEvents.GotFocus = string.Format("function(s, e) {{ OnGotFocusEventHander(s, e, {0}); }}", templateContainer.KeyValue); }
protected void grvIA_OnHtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) { try { ASPxGridView grv = (sender as ASPxGridView); ASPxButton btnIAInfo = (ASPxButton)grv.FindRowCellTemplateControl(e.VisibleIndex, null, "btnIAInfo"); if (grv.GetRowValues(e.VisibleIndex, "Info") != null && grv.GetRowValues(e.VisibleIndex, "Info").ToString().Trim().Length > 0) { IA ia = IrregAltRepository.RetrieveIAHeadersById(Convert.ToInt32(btnIAInfo.CommandArgument)); btnIAInfo.Text = (grv.GetRowValues(e.VisibleIndex, "Info").ToString()) + System.Environment.NewLine + "(" + ia.InfoNumber + ")"; } ASPxLabel lblPart = (ASPxLabel)grv.FindRowCellTemplateControl(e.VisibleIndex, null, "lblPart"); if (lblPart != null) { int id = Convert.ToInt32(grv.GetRowValues(e.VisibleIndex, "Id")); lblPart.Text = IrregAltRepository.RetrieveIrregAlterationPartsById(id); } ASPxLabel lblModel = (ASPxLabel)grv.FindRowCellTemplateControl(e.VisibleIndex, null, "lblModelName"); if (lblModel != null) { string ModelName = ControlPlanRepository.RetrieveAssemblyModelNameById(Convert.ToInt32(hfDocControl["ModelId"])); lblModel.Text = ModelName; } } catch (Exception ex) { LoggerHelper.LogError(ex); } }
private void SetChangePasswordVisibility(bool IsVisible) { try { ASPxButton btnChange = gridUsers.FindEditFormTemplateControl("btnChangePassword") as ASPxButton; ASPxTextBox txtPassword = gridUsers.FindEditFormTemplateControl("txtEfPassword") as ASPxTextBox; ASPxLabel lblPassword = gridUsers.FindEditFormTemplateControl("lblEfPassword") as ASPxLabel; if (btnChange != null) { btnChange.Visible = !IsVisible; } if (txtPassword != null) { txtPassword.Visible = IsVisible; } if (lblPassword != null) { lblPassword.Visible = IsVisible; } } catch (Exception ex) { Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error); } }
public void InstantiateIn(Control container) { var btnNew = new ASPxButton(); btnNew.AutoPostBack = false; btnNew.ClientSideEvents.Click = "function(s,e){" + _grid.ClientInstanceName + ".AddNewRow();}"; btnNew.Text = "新建"; var btnDelete = new ASPxButton(); btnDelete.Text = "删除"; var btnSave = new ASPxButton(); btnSave.Text = "保存"; var btnCancel = new ASPxButton(); btnCancel.Text = "取消"; container.Controls.Add(btnNew); container.Controls.Add(btnDelete); container.Controls.Add(btnSave); container.Controls.Add(btnCancel); }
//Botón en columna Nombre, abre archivo protected void ASPxButtonDoc_Click(object sender, EventArgs e) { try { ASPxButton btn = (ASPxButton)sender; btn.ImageUrl = "~/img/iconos/ico_doc1.png"; GridViewDataItemTemplateContainer container = (GridViewDataItemTemplateContainer)btn.NamingContainer; string v_FILESDSKEY = GridDS.GetRowValues(container.VisibleIndex, "FILESDSKEY").ToString().Trim(); string v_NOMBRE = GridDS.GetRowValues(container.VisibleIndex, "DSNAME").ToString().Trim(); Guid guidkey = Guid.Parse(v_FILESDSKEY); string mensaje = string.Empty; DataTable dt = new DataTable(); byte[] vByte; vByte = exp.Trae_Archivo_DATA_STAGE(guidkey, lblCadena.Text, ref mensaje); Response.Clear(); MemoryStream ms = new MemoryStream(vByte); Response.ContentType = "application/zip"; Response.AddHeader("content-disposition", "attachment;filename=" + v_NOMBRE); Response.Buffer = true; ms.WriteTo(Response.OutputStream); HttpContext.Current.ApplicationInstance.CompleteRequest(); Response.End(); } catch (Exception ex) {} }
protected void RequestIdButton_Click(object sender, EventArgs e) { ViewState["IsNewRecord"] = false; ASPxButton btn = (ASPxButton)sender; GridViewDataItemTemplateContainer container = (GridViewDataItemTemplateContainer)btn.NamingContainer; var value = container.Grid.GetRowValues(container.VisibleIndex, new string[] { "RequestId" }); long requestId = (long)value; try { tinRequest = context.ITINRequests.Single(r => r.RequestId == requestId); context.Entry(tinRequest).Reload(); OriginLgaCombo_Callback(new object(), new CallbackEventArgsBase(tinRequest.OriginStateId)); AddressLgaCombo_Callback(new object(), new CallbackEventArgsBase(tinRequest.AddressStateId)); TinRequestForm.DataSource = tinRequest; TinRequestForm.DataBind(); Session["TinRequest"] = tinRequest; TinRequestMultiView.ActiveViewIndex = 1; SetButtonVisibility(); } catch (Exception ex) { DisplayAlert("Danger", "Get Individual Taxpayer", ex.Message); return; } }
protected void ASPxButton1_Init(object sender, EventArgs e) { ASPxButton button = sender as ASPxButton; GridViewDataItemTemplateContainer container = button.NamingContainer as GridViewDataItemTemplateContainer; button.ID = "ASPxButton1" + container.KeyValue; }
public void SettingInit(Guid VoucherId, ASPxButton SourceButton, string completeEventName) { this.VoucherId = VoucherId; dsOriginArtifact.CriteriaParameters["VoucherId"].DefaultValue = VoucherId.ToString(); dsVoucherAllocation.CriteriaParameters["VoucherId"].DefaultValue = VoucherId.ToString(); frmCosting.DataBind(); if (!MainControlClientName.Equals(string.Empty)) { SourceButton.ClientSideEvents.Click = "function(s, e){ " + string.Format("{0}.PerformCallback('open');", MainControlClientName) + " }"; cpVoucherBookingEntry.ClientSideEvents.BeginCallback = "function(s, e){ " + string.Format("{0}.Show();", ldpnCostingEditForm.ClientInstanceName) + " }"; cpVoucherBookingEntry.ClientSideEvents.EndCallback = "function(s, e){ " + string.Format("{0}.Hide(); ", ldpnCostingEditForm.ClientInstanceName) + "target.fire({ type: '" + completeEventName + "' }); " + " }"; ButtonApproveCosting.ClientSideEvents.Click = "function(s, e){ " + string.Format("{0}.PerformCallback('Book');", MainControlClientName) + " }"; ButtonCancel.ClientSideEvents.Click = "function(s, e){ " + string.Format("{0}.PerformCallback('Cancel');", MainControlClientName) + " }"; } }
protected void IdBtndelete_Click(object sender, EventArgs e) { ASPxButton btn = sender as ASPxButton; GridViewDataItemTemplateContainer container = btn.NamingContainer as GridViewDataItemTemplateContainer; var Rowindex = container.VisibleIndex; int ValueRowId = int.Parse(GVDataAttachment.GetRowValues(Rowindex, "Id").ToString()); //var Data = Session["DataDetail"]; var oldattachImage = Session["dtAttachment"] as List <ProductionFaultReleaseAttachmentModel>; DataTable Datax = Session["dtAttachment"] as DataTable; //List<DocumentAttachment> ListAttachFile = new List<DocumentAttachment>(); //List<DataRow> list = Datax.AsEnumerable().ToList(); //int Id = int.Parse(Datax.Rows[0].ItemArray[0].ToString()); for (int i = 0; i < Datax.Rows.Count; i++) { int Id = int.Parse(Datax.Rows[i].ItemArray[0].ToString()); if (Id == ValueRowId) { DataRow dr = Datax.Rows[i]; dr.Delete(); // dr.AcceptChanges(); } } DataTable DataNew = new DataTable(); DataNew = Datax; GVDataAttachment.DataSource = DataNew; Session["dtAttachment"] = DataNew; GVDataAttachment.DataBind(); }
protected void grd_Do_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { if (this.grd_Do.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = this.grd_Do.FindEditFormTemplateControl("pageControl") as ASPxPageControl; //ASPxTextBox partyName = grd_Do.FindEditFormTemplateControl("txt_PartyName") as ASPxTextBox; ASPxTextBox txt_DoNo = this.grd_Do.FindEditFormTemplateControl("txt_DoNo") as ASPxTextBox; //partyName.Text = EzshipHelper.GetPartyName(this.grd_Do.GetRowValues(this.grd_Do.EditingRowVisibleIndex, new string[] { "PartyId" })); string oid = SafeValue.SafeString(this.grd_Do.GetRowValues(this.grd_Do.EditingRowVisibleIndex, new string[] { "Id" })); if (oid.Length > 0) { ASPxDateEdit txt_Date = this.grd_Do.FindEditFormTemplateControl("txt_Date") as ASPxDateEdit; txt_Date.BackColor = ((DevExpress.Web.ASPxEditors.ASPxTextBox)(this.grd_Do.FindEditFormTemplateControl("txt_DoNo"))).BackColor; txt_Date.ReadOnly = true; string sql = string.Format("select DoStatus from wh_Trans where Id='{0}'", oid); string closeInd = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql), "USE");// ASPxButton btn = this.grd_Do.FindEditFormTemplateControl("btn_CloseJob") as ASPxButton; //ASPxButton btn_Void = this.grd_Do.FindEditFormTemplateControl("btn_Void") as ASPxButton; if (closeInd == "Closed") { btn.Text = "Open Job"; } //if (closeInd == "CNL") // { // btn_Void.Text = "Unvoid"; // } } } }
void ITemplate.InstantiateIn(Control container) { Table table = new Table(); table.CellPadding = 0; table.CellSpacing = 0; table.Rows.Add(new TableRow()); table.Rows[0].Cells.Add(new TableCell()); table.Rows[0].Cells.Add(new TableCell()); ASPxButton btnExpandCollapse = new ASPxButton(); btnExpandCollapse.Text = "-"; btnExpandCollapse.AllowFocus = false; btnExpandCollapse.AutoPostBack = false; btnExpandCollapse.Width = Unit.Pixel(20); btnExpandCollapse.FocusRectPaddings.Padding = Unit.Parse("0"); btnExpandCollapse.ClientSideEvents.Click = "function (s,e) { " + "var isVisible = " + _panel.ClientInstanceName + ".GetVisible();\n" + "s.SetText(isVisible ? '+' : '-');\n" + _panel.ClientInstanceName + ".SetVisible(!isVisible);\n" + "}"; table.Rows[0].Cells[0].Controls.Add(new LiteralControl(_caption)); table.Rows[0].Cells[0].Style["white-space"] = "nowrap"; table.Rows[0].Cells[1].Controls.Add(btnExpandCollapse); table.Rows[0].Cells[1].Style["width"] = "1%"; table.Rows[0].Cells[1].Style["padding-left"] = "5px"; container.Controls.Add(table); }
protected void TinButton_Click(object sender, EventArgs e) { ASPxButton btn = (ASPxButton)sender; GridViewDataItemTemplateContainer container = (GridViewDataItemTemplateContainer)btn.NamingContainer; var value = container.Grid.GetRowValues(container.VisibleIndex, new string[] { "TIN" }); string tin = (string)value; try { taxpayer = context.CTaxpayers.Single(r => r.TIN == tin); context.Entry(taxpayer).Reload(); AddressStateCombo_Callback(null, new CallbackEventArgsBase(taxpayer.RegisteredAddressCountryId.ToString())); AddressLgaCombo_Callback(new object(), new CallbackEventArgsBase(taxpayer.RegisteredAddressStateId)); CTaxpayerForm.DataSource = taxpayer; CTaxpayerForm.DataBind(); TaxpayerMultiView.ActiveViewIndex = 1; } catch (Exception ex) { DisplayAlert("Danger", "Get Individual Taxpayer", ex.Message); return; } }
public void InstantiateIn(Control container) { ASPxLabel lbl = new ASPxLabel(); lbl.ID = "lblFrom"; lbl.Text = "From:"; container.Controls.Add(lbl); ASPxDateEdit dateFrom = new ASPxDateEdit(); dateFrom.ID = "dateFrom"; dateFrom.ClientInstanceName = "dFrom"; dateFrom.Date = new DateTime(1950, 1, 1); container.Controls.Add(dateFrom); lbl = new ASPxLabel(); lbl.ID = "lblTo"; lbl.Text = "To:"; container.Controls.Add(lbl); ASPxDateEdit dateTo = new ASPxDateEdit(); dateTo.ID = "dateTo"; dateTo.ClientInstanceName = "dTo"; dateTo.Date = new DateTime(1960, 11, 30); container.Controls.Add(dateTo); ASPxButton btn = new ASPxButton(); btn.ID = "btnApply"; btn.Text = "Apply"; btn.AutoPostBack = false; btn.ClientSideEvents.Click = "function (s, e) { ApplyFilter( dFrom, dTo ); }"; container.Controls.Add(btn); }
/// <summary> /// 导出明细数据到EXCEL表。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDetailXlsExport_Click(object sender, EventArgs e) { ASPxButton btn = (ASPxButton)sender; ASPxGridView detailGrid = (btn.Parent.FindControl("detailGrid") as ASPxGridView); if (detailGrid != null) { string keyValue = Convert.ToString(detailGrid.GetMasterRowKeyValue()); string productModel = keyValue.Split('$')[0]; string dataType = keyValue.Split('$')[1]; DataSet ds = Cache[Session.SessionID + dataType] as DataSet; if (ds == null) { BindDetailData(detailGrid, productModel, dataType); ds = Cache[Session.SessionID + dataType] as DataSet; } string fileName = this.lblType.Text; Response.Clear(); Response.Buffer = true; Response.AppendHeader("content-disposition", "attachment;filename=\"" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8) + ".xls\""); Response.ContentType = "Application/ms-excel"; Export.ExportToExcel(Response.OutputStream, ds.Tables[0]); Response.End(); } }
protected void grid_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e) { if (this.grid.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox txt_PartyId = pageControl.FindControl("txtPartyId") as ASPxTextBox; txt_PartyId.Enabled = false; string partyId = SafeValue.SafeString(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "PartyId" })); string sql = "select Salesman from XXPartySales where PartyId='" + partyId + "' and DefaultInd='Y'"; string salesMan = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql)); ASPxTextBox txt_DefaultSale = pageControl.FindControl("txt_DefaultSale") as ASPxTextBox; txt_DefaultSale.Text = salesMan; ASPxButton btn_Block = this.grid.FindEditFormTemplateControl("btn_Block") as ASPxButton; ASPxLabel status = pageControl.FindControl("lblStatus") as ASPxLabel; if (partyId.Length > 0) { sql = string.Format("select Status from XXParty where PartyId='{0}'", partyId); string closeInd = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql));// closeIndStr.Text if (closeInd == "InActive") { status.Text = "InActive"; btn_Block.Text = "UnLock"; } else { status.Text = "USE"; btn_Block.Text = "Lock"; } dsRefContact.FilterExpression = "PartyId='" + partyId + "'"; } } }
protected void downloadButton_Click(object sender, EventArgs e) { //string filename = "Docs\\2kk2di2p.pdf"; //ASPxButton button = (ASPxButton)sender; //GridViewDataItemTemplateContainer container = button.NamingContainer as GridViewDataItemTemplateContainer; //int visibleIndex = container.VisibleIndex; ////string text = container.Grid.GetRowValues(visibleIndex, "Text").ToString(); //Response.Clear(); //Response.Buffer = false; ////Response.AppendHeader("Content-Type", "text/html; charset=utf-8"); ////Response.AppendHeader("Content-Transfer-Encoding", "binary"); //Response.AppendHeader("Content-Disposition", "attachment; filename="+ filename); ////Response.BinaryWrite(new UTF8Encoding().GetBytes(text)); //Response.End(); ASPxButton button = (ASPxButton)sender; GridViewDataItemTemplateContainer container = button.NamingContainer as GridViewDataItemTemplateContainer; int visibleIndex = container.VisibleIndex; string text = container.Grid.GetRowValues(visibleIndex, "ID").ToString(); var list = db.S_Dokumanlar(Convert.ToInt32(text)).ToList(); if (list.Count > 0) { SendFile(list.FirstOrDefault().DosyaAdi); } }
protected void grid_HtmlEditFormCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewEditFormEventArgs e) { if (this.grid.EditingRowVisibleIndex > -1) { ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl; ASPxTextBox partyName = pageControl.FindControl("txt_PartyName") as ASPxTextBox; ASPxTextBox whName = pageControl.FindControl("txt_WhName") as ASPxTextBox; ASPxDateEdit txt_Date = pageControl.FindControl("txt_Date") as ASPxDateEdit; txt_Date.Enabled = false; partyName.Text = EzshipHelper.GetPartyName(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "PartyId" })); whName.Text = EzshipHelper.GetWarehouse(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "WhCode" })); string oid = SafeValue.SafeString(this.grid.GetRowValues(this.grid.EditingRowVisibleIndex, new string[] { "Id" })); if (oid.Length > 0) { string sql = string.Format("select StatusCode from wh_Contract where Id='{0}'", oid); string closeInd = SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(sql), "USE");// ASPxButton btn = this.grid.FindEditFormTemplateControl("btn_CloseJob") as ASPxButton; ASPxButton btn_VoidMaster = this.grid.FindEditFormTemplateControl("btn_Void") as ASPxButton; if (closeInd == "CLS") { btn.Text = "Open Job"; } if (closeInd == "CNL") { btn_VoidMaster.Text = "Unvoid"; } else { btn.Text = "Close"; } } } }
//public string getCharacterInButtonByTaxCode(string TypeCode) //{ // if (TypeCode.Equals("TAXTYPE_VAT_PRODUCT")) // return "A"; // if (TypeCode.Equals("TAXTYPE_SPECIAL_PRODUCT")) // return "B"; // if (TypeCode.Equals("TAXTYPE_RESOURCE_PRODUCT")) // return "C"; // if (TypeCode.Equals("TAXTYPE_VAT_SERVICE")) // return "D"; // return string.Empty; //} protected void grdVariableOfTax_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e) { /*2013-11-24 ERP-1125 Khoa.Truong MOD START*/ //if (e.DataColumn.FieldName.Equals("TaxTypeName")) //{ // ASPxButton btn = grdVariableOfTax.FindRowCellTemplateControlByKey(e.KeyValue, // grdVariableOfTax.Columns["TaxTypeName"] as GridViewDataColumn, "btnSelectVariable") as ASPxButton; // btn.Text = string.Format("[{0}]", Convert.ToChar(65 + e.VisibleIndex).ToString()); // btn.ClientSideEvents.Click = "function(s, e){uEvaluantCalculator_InsertText(" + // txtFormulaExpress.ClientInstanceName + // ", '" + // btn.Text +"')}"; //} if (e.DataColumn.FieldName.Equals("Code")) { ASPxButton btn = grdVariableOfTax.FindRowCellTemplateControlByKey(e.KeyValue, grdVariableOfTax.Columns["Code"] as GridViewDataColumn, "btnSelectVariable") as ASPxButton; //btn.Text = string.Format("[{0}]", Convert.ToChar(65 + e.VisibleIndex).ToString()); btn.Text = string.Format("[{0}]", e.CellValue.ToString());//string.Format("[{0}]", Convert.ToChar(65 + e.VisibleIndex).ToString()); btn.ClientSideEvents.Click = "function(s, e){uEvaluantCalculator_InsertText(" + txtFormulaExpress.ClientInstanceName + ", '" + btn.Text + "')}"; } /*2013-11-24 ERP-1125 Khoa.Truong MOD END*/ //if (e.DataColumn.Name.Equals("Desciption")) //{ // e.Cell.Text = getDesciption(e.KeyValue.ToString()); //} }
protected override ASPxButton[] GetChildButtons() { ASPxButton[] buttons = new ASPxButton[] { btnDismissAll, btnDismiss, btnSnooze }; return buttons; }
protected override void OnInit(EventArgs e) { base.OnInit(e); //ASPxTextBox t = new ASPxTextBox(); TextBox t = new TextBox(); t.AutoPostBack = false; PlaceHolder1.Controls.Add(t); ASPxButton bt = new ASPxButton(); bt.ID = "btTest"; bt.Text = "ASPxButton"; bt.Click += new EventHandler(EventHandler1); bt.UseSubmitBehavior = false; PlaceHolder1.Controls.Add(bt); Button bt1 = new Button(); bt1.Text = "Button"; bt1.UseSubmitBehavior = false; bt1.Click += new EventHandler(EventHandler1); PlaceHolder1.Controls.Add(bt1); }
private Control CreateCellControl(int row, int column) { int cellIndex = (RenderInRows) ? row * ColumnCount + column : column * RowCount + row; if (row * ColumnCount + column < CellCount) { ASPxDropDownEdit parent = Container.NamingContainer.NamingContainer as ASPxDropDownEdit; ASPxButton button = new ASPxButton(); button.ID = String.Format("btTime_{0}_{1}", row, column); DateTime time = new DateTime(0); time = time.AddMinutes(StartTime + Interval * cellIndex); button.Text = time.ToString("HH:mm"); button.Checked = (button.Text == parent.Text); button.Width = new Unit(100, UnitType.Percentage); button.AutoPostBack = false; button.GroupName = parent.UniqueID; button.ClientSideEvents.Click = String.Format("function (s, e) {{ {0}.SetText(s.GetText()); {0}.HideDropDown(); }}", parent.ClientInstanceName); return(button); } return(null); }
protected override ASPxButton[] GetChildButtons() { ASPxButton[] buttons = new ASPxButton[] { btnSave, btnCancel, btnEditForm }; return(buttons); }
protected void btnXoaHang_Init(object sender, EventArgs e) { ASPxButton btnButton = sender as ASPxButton; GridViewDataRowTemplateContainer container = btnButton.NamingContainer as GridViewDataRowTemplateContainer; btnButton.ClientSideEvents.Click = String.Format("function(s, e) {{ onXoaHangChanged({0}); }}", container.KeyValue); }
protected virtual void CreateExpandAllButtonCell() { MainRow.Cells.Add( ExpandAllButtonCell = RenderUtils.CreateTableCell().Add( ExpandAllButton = new ASPxButton() ) ); ExpandAllButton.ID = GetControlID("ExpandAllButton"); }
private void CreatePerformSearchButton() { CBContainerRow.Add( CBPerformSearchButtonCell = RenderUtils.CreateTableCell().Add( PerformSearchButton = new ASPxButton() ) ); PerformSearchButton.ID = RoundPanel.GetPerformSearchButtonID(); }
protected override void ClearControlFields() { base.ClearControlFields(); CBContainerTable = null; CBContainerRow = null; CBPerformSearchButtonCell = null; CBSeparatorCell = null; CBCancelSearchButtonCell = null; CBPlaceholderCell = null; PerformSearchButton = null; CancelSearchButton = null; }
protected override void ClearControlFields() { MainRow = null; ExpandAllButtonCell = null; ButtonSeparatorCell = null; CollapseAllButtonCell = null; ExpandAllButton = null; ButtonSeparator = null; ButtonSeparatorImage = null; ButtonSeparatorText = null; CollapseAllButton = null; }
protected override void OnInit(EventArgs e) { base.OnInit(e); //ASPxTextBox t = new ASPxTextBox(); TextBox t = new TextBox(); t.AutoPostBack = false; PlaceHolder1.Controls.Add(t); ASPxButton bt = new ASPxButton(); bt.ID = "btTest"; bt.Text = "ASPxButton"; bt.Click += new EventHandler(EventHandler1); bt.UseSubmitBehavior = false; PlaceHolder1.Controls.Add(bt); Button bt1 = new Button(); bt1.Text = "Button"; bt1.UseSubmitBehavior = false; bt1.Click += new EventHandler(EventHandler1); PlaceHolder1.Controls.Add(bt1); }
protected virtual void CreateCollapseAllButtonCell() { MainRow.Cells.Add( CollapseAllButtonCell = RenderUtils.CreateTableCell().Add( CollapseAllButton = new ASPxButton() ) ); CollapseAllButton.ID = GetControlID("CollapseAllButton"); }
protected override void AssignDataSourceToControl(object dataSource){ if (_table != null){ ClearAllCollectionsOfControls(); _table.Rows.Clear(); var tr = new TableRow(); _table.Rows.Add(tr); var tc = new TableCell(); tr.Cells.Add(tc); if (AllowEdit && ShowButtons){ _btnAddFirst = new ASPxButton{AutoPostBack = false, EnableClientSideAPI = true}; _btnAddFirst.SetClientSideEventHandler("Click", "function(s, e) { " + "CallbackPanel" + Model.Id + ".PerformCallback(\"add\"); }"); _btnAddFirst.Text = AddButtonCaption; _btnAddFirst.ID = "btnAddFirst"; _btnAddFirst.Visible = true; tc.Controls.Add(_btnAddFirst); } _dataSourceList = ListHelper.GetList(dataSource); if (_dataSourceList == null) return; if (HeadersOnTopOnly) CreateHeaderRows(null).ForEach(hr => _table.Rows.Add(hr)); if (_dataSourceList.Count > 0){ int rowindex = 0; foreach (XPBaseObject item in _dataSourceList){ CreateRowForObject(item, false, rowindex); rowindex++; } } CreateFooterRow(); ToggleHeadersVisibility(); foreach (IModelColumn column in Model.Columns){ if (column.Index >= 0){ if ( _controlsPerObjectInList.Values.ToList() .TrueForAll( d => d.ContainsKey(column.PropertyName) && !d[column.PropertyName].Visible)){ if (_headerCellsPerColumn.ContainsKey(column.PropertyName)) _headerCellsPerColumn[column.PropertyName].Visible = false; if (_footerCellsPerColumn.ContainsKey(column.PropertyName)) _footerCellsPerColumn[column.PropertyName].Visible = false; } } } } }
private void CreateRowForObject(XPBaseObject item, bool focusFirstControl, int rowindex){ _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)] = new List<TableRow>(); var headerRowsForItem = new List<TableRow>(); if (!HeadersOnTopOnly){ headerRowsForItem = CreateHeaderRows(item, rowindex); _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)].AddRange(headerRowsForItem); } if (_btnAddFirst != null) _btnAddFirst.Visible = false; TableRow tr = null; var controlsOfRowPerColumn = new Dictionary<string, ASPxEdit>(); int i = 0; int headerrowsadded = 0; bool firstControlFocused = false; foreach (IModelColumn column in Model.Columns){ if (column.Index >= 0){ if (i%ColumnsPerRow == 0){ if (headerRowsForItem.Count > headerrowsadded){ _table.Rows.Add(headerRowsForItem[headerrowsadded]); headerrowsadded++; } tr = new TableRow{CssClass = rowindex%2 == 0 ? "evenrow" : "oddrow"}; _table.Rows.Add(tr); _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)].Add(tr); } i++; var tc = new TableCell(); if (tr != null) tr.Cells.Add(tc); if (!AllowEdit){ object itemGetMemberValue = item.GetMemberValue(column.PropertyName); if (itemGetMemberValue == null) tc.Text = ""; else if (itemGetMemberValue is XPBaseObject){ ITypeInfo typeInfo = XafTypesInfo.Instance.FindTypeInfo( (itemGetMemberValue as XPBaseObject).ClassInfo.ClassType); if (typeInfo.DefaultMember != null){ object defMembVal = (itemGetMemberValue as XPBaseObject).GetMemberValue(typeInfo.DefaultMember.Name); tc.Text = defMembVal != null ? defMembVal.ToString() : ""; } else tc.Text = itemGetMemberValue.ToString(); } else if (itemGetMemberValue is Enum){ { string caption = new EnumDescriptor(column.ModelMember.MemberInfo.MemberType).GetCaption( itemGetMemberValue); tc.Text = string.IsNullOrEmpty(column.DisplayFormat) ? caption : string.Format(column.DisplayFormat, caption); } } else{ if (!string.IsNullOrEmpty(column.DisplayFormat)){ tc.Text = string.Format(column.DisplayFormat, itemGetMemberValue); } else if (itemGetMemberValue is decimal){ tc.Text = string.Format("{0:C2}", itemGetMemberValue); } else tc.Text = itemGetMemberValue.ToString(); } tc.CssClass = "StaticText"; } else{ ASPxEdit cellControl = GetControlForColumn(column, item); if (!column.AllowEdit) cellControl.Enabled = false; //handle control width int tableColumns = Math.Max(Model.Columns.Count(c => c.Index >= 0), ColumnsPerRow); if (cellControl is ASPxCheckBox){ tc.Width = new Unit(1, UnitType.Percentage); } else if (tableColumns>0){ var value = 100/tableColumns; tc.Width = new Unit(value, UnitType.Percentage); } cellControl.ID = column.PropertyName + "_control_" + item.GetMemberValue(Model.ModelClass.KeyProperty) .ToString() .Replace("-", "_minus_"); cellControl.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithTooltip; cellControl.ValidationSettings.Display = Display.Dynamic; cellControl.ValidationSettings.ErrorTextPosition = ErrorTextPosition.Left; cellControl.ValidationSettings.ErrorImage.Url = ImageLoader.Instance.GetImageInfo("ximage").ImageUrl; controlsOfRowPerColumn.Add(column.PropertyName, cellControl); _baseObjectsHandledByControl[cellControl] = new Tuple<XPBaseObject, string>(item, column.PropertyName); tc.Controls.Add(cellControl); if (focusFirstControl && !firstControlFocused){ cellControl.Focus(); firstControlFocused = true; } } OnCustomizeAppearance(new CustomizeAppearanceEventArgs(column.PropertyName, new WebControlAppearanceAdapter(tc, tc), item)); } } if (tr == null){ tr = new TableRow{CssClass = rowindex%2 == 0 ? "evenrow" : "oddrow"}; _table.Rows.Add(tr); _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)].Add(tr); } var tcButtons = new TableCell{Wrap = false, Width = new Unit(1, UnitType.Percentage)}; if (i%ColumnsPerRow != 0){ tcButtons.ColumnSpan = ColumnsPerRow - i%ColumnsPerRow; } else{ tr = new TableRow{CssClass = rowindex%2 == 0 ? "evenrow" : "oddrow"}; _table.Rows.Add(tr); _rowsPerObject[item.GetMemberValue(Model.ModelClass.KeyProperty)].Add(tr); //a new row will be created and the whole row will be the buttons tcButtons.ColumnSpan = ColumnsPerRow; } tr.Cells.Add(tcButtons); var tblButtons = new Table(); tcButtons.Controls.Add(tblButtons); var btnsrow = new TableRow(); tblButtons.Rows.Add(btnsrow); if (AllowEdit && ShowButtons){ var btnRemove = new ASPxButton{AutoPostBack = false, EnableClientSideAPI = true}; btnRemove.SetClientSideEventHandler("Click", "function(s, e) { " + "CallbackPanel" + Model.Id + ".PerformCallback(\"rem_" + item.GetMemberValue(Model.ModelClass.KeyProperty) + "\"); }"); btnRemove.Text = DeleteButtonCaption; btnRemove.ID = "btnRemove_" + item.GetMemberValue(Model.ModelClass.KeyProperty); var t = new TableCell(); btnsrow.Cells.Add(t); t.Controls.Add(btnRemove); } if (AllowEdit && ShowButtons){ var btnAdd = new ASPxButton{AutoPostBack = false, EnableClientSideAPI = true}; btnAdd.SetClientSideEventHandler("Click", "function(s, e) { " + "CallbackPanel" + Model.Id + ".PerformCallback(\"add\"); }"); btnAdd.Text = AddButtonCaption; btnAdd.ID = "btnAdd_" + item.GetMemberValue(Model.ModelClass.KeyProperty); var t = new TableCell(); btnsrow.Cells.Add(t); t.Controls.Add(btnAdd); } _controlsPerObjectInList[item.GetMemberValue(Model.ModelClass.KeyProperty)] = controlsOfRowPerColumn; }
protected virtual void CreateHeaderECButton() { HeaderContentRow.Add( HeaderECButtonCell = RenderUtils.CreateTableCell().Add( HeaderECButton = new ASPxButton() ) ); HeaderECButton.ID = RoundPanel.GetHeaderECButtonID(); }
private void CreateCancelSearchButton() { CBContainerRow.Add( CBCancelSearchButtonCell = RenderUtils.CreateTableCell().Add( CancelSearchButton = new ASPxButton() ) ); CancelSearchButton.ID = RoundPanel.GetCancelSearchButtonID(); }
private static void SetImageSettings(ASPxButton button, ASPxSmartGridViewECCommandButtonSettings buttonSettings, GridViewCommandButtonType buttonType) { switch (buttonType) { case GridViewCommandButtonType.Link: break; default: button.Image.CopyFrom(buttonSettings.Image); break; } }
public static void CreateDynamicForm(Table tblControls, string xmlForm) { XmlDocument doc = new XmlDocument(); var xmlReader = XmlTextReader.Create(new StringReader(xmlForm)); doc.Load(xmlReader); foreach (XmlNode xmlNode in doc.ChildNodes.Item(1).ChildNodes) { var controlType = xmlNode.GetAttribute("CTIPO"); TableRow tableRow = new TableRow(); TableCell cellLabel = new TableCell(); TableCell cellControl = new TableCell(); if (controlType != "SEPARADOR") { IRendereable control = RendereableControlFactory.GetControl(controlType); List<WebControl> webControls = control.RenderControl(xmlNode); cellLabel.Controls.Add(webControls[0]); bool firstPass = true; foreach (var webControl in webControls) { if (firstPass) firstPass = false; else { cellControl.Controls.Add(webControl); // TODO: Agregar un <BR> } } } else { Literal literal = new Literal(); literal.Text = "<HR>"; cellLabel.Controls.Add(literal); } if ((controlType == "TITULO") || (controlType == "SEPARADOR")) { cellLabel.ColumnSpan = 2; tableRow.Cells.Add(cellLabel); } else { tableRow.Cells.Add(cellLabel); tableRow.Cells.Add(cellControl); } tblControls.Rows.Add(tableRow); } ASPxButton aspxButton = new ASPxButton(); aspxButton.ID = "btnAccept"; aspxButton.Text = "Aceptar"; aspxButton.ValidationGroup = "InputValidation"; TableRow tableRowInput = new TableRow(); TableCell tableCell = new TableCell { HorizontalAlign = HorizontalAlign.Right }; tableCell.Controls.Add(aspxButton); tableRowInput.Cells.Add(new TableCell()); tableRowInput.Cells.Add(tableCell); tblControls.CellPadding = 3; tblControls.Rows.Add(tableRowInput); }