protected override void OnInit(EventArgs e) { base.OnInit(e); cbxFund = new ASPxComboBox(); lblFUnd = new ASPxLabel(); cbFund = new ASPxCallback(); }
protected override void OnInit(EventArgs e) { base.OnInit(e); tbControl = new Table() { CellPadding = 0, CellSpacing = 0 }; TableRow row = new TableRow(); row.Cells.Add(new TableCell() { HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left, VerticalAlign = System.Web.UI.WebControls.VerticalAlign.Middle }); row.Cells.Add(new TableCell() { HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left, VerticalAlign = System.Web.UI.WebControls.VerticalAlign.Middle }); tbControl.Rows.Add(row); tbControl.Rows[0].Cells[1].Attributes.Add("style", "padding-left:2px"); lblName = new ASPxLabel() { ID = "lblName", ClientInstanceName = this.ClientID + "_lblName", }; hddData = new ASPxHiddenField() { ID = "hddData", ClientInstanceName = this.ClientID + "_hddData", }; sqlDataSource = new SqlDataSource() { ID = this.ClientID + "_sqlDataSource", SelectCommandType = SqlDataSourceCommandType.Text, }; cbClickGdvRow = new ASPxCallback() { ID = "cbClickGdvRow", ClientInstanceName = this.ClientID + "_cbClickGdvRow", }; bteTextInput = new ASPxButtonEdit() { ID = "bteTextInput", ClientInstanceName = this.ClientID + "_bteTextInput", }; popDataList = new ASPxPopupControl() { ID = "popDataList", ClientInstanceName = this.ClientID + "_popDataList", }; gdvDataList = new ASPxGridView() { ID = "gdvDataList", ClientInstanceName = this.ClientID + "_gdvDataList", EnableRowsCache = false, EnableViewState = false, }; }
//void cbValidate_Callback(object source, CallbackEventArgs e) //{ // string imageUrl = ""; // if (e.Parameter == "ok") // { // imageUrl = "~/Images/led_icon/accept.png"; // } // else // { // imageUrl = "~/Images/led_icon/cross.png"; // } // e.Result = Page.ResolveUrl(imageUrl); //} protected override void OnInit(EventArgs e) { base.OnInit(e); tbxBankNumber = new ASPxTextBox(); cbValidate = new ASPxCallback(); imgValidate = new ASPxImage(); table = new HtmlTable(); tableRow = new HtmlTableRow(); }
protected void OnCallback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { Control resControl = null; if (!string.IsNullOrEmpty(e.Parameter)) { resControl = Page.LoadControl(string.Format(UserControlPathTemplate, e.Parameter)); } e.Result = resControl != null?ASPxCallback.GetRenderResult(resControl) : ""; }
protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { System.Threading.Thread.Sleep(2000); //Paused for demonstrative purposes ASPxCallback callbackControl = source as ASPxCallback; string time = DateTime.Now.ToString("T"); TextBox1.Text = time; callbackControl.JSProperties["cpTextBox1"] = ASPxCallback.GetRenderResult(TextBox1); callbackControl.JSProperties["cpTime"] = time; }
protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { int pageIndex = int.Parse(e.Parameter); int pageCount = BindPagedData(pageIndex); e.Result = ASPxCallback.GetRenderResult(Repeater1); ASPxCallback1.JSProperties["cpIsEnd"] = pageIndex == (pageCount - 1); // Intentionally pauses server-side processing, // to demonstrate the Loading Panel functionality. System.Threading.Thread.Sleep(500); }
public override System.Web.UI.Control Build() { base.Build(); ASPxPanel panel = new ASPxPanel(); ASPxUploadControl uploadfile = new ASPxUploadControl(); ASPxButton uploadfilebutton = new ASPxButton(); ASPxLabel uploadfileurl = new ASPxLabel(); ASPxButton uploadfiledelete = new ASPxButton(); ASPxCallback callbackfiledelete = new ASPxCallback(); //定义上传框体 uploadfile.BrowseButton.Text = "浏览"; uploadfile.ClientInstanceName = "uploadfile"; uploadfile.FileUploadComplete += new EventHandler <FileUploadCompleteEventArgs>(FileUploadComplete); //uploadfile.ClientSideEvents.FilesUploadComplete = "function(s, e) { Uploader_PicturesUploadComplete(e); }"; uploadfile.ClientSideEvents.FileUploadComplete = "function(s, e) { Uploader_FileUploadComplete(e); }"; uploadfile.ClientSideEvents.FileUploadStart = "function(s, e) { Uploader_FileUploadStart(); }"; uploadfile.ClientSideEvents.TextChanged = "function(s, e) { FileUpdateUploadButton(); }"; //uploadfile.ValidationSettings.MaxFileSize = 4194304; //string[] fileExtensions = new string[4] { ".jpg", ".jpeg", ".jpe", ".gif" }; //uploadfile.ValidationSettings.AllowedFileExtensions = fileExtensions; //定义上传文件按钮 uploadfilebutton.AutoPostBack = false; uploadfilebutton.Text = "上传"; uploadfilebutton.ClientEnabled = false; uploadfilebutton.ClientInstanceName = "uploadfilebutton"; uploadfilebutton.ClientSideEvents.Click = "function(s, e) { uploadfiledeletefunc();uploadfile.Upload();}"; //定义上传后文件名显示 uploadfileurl.Text = "文件名:"; uploadfileurl.ClientInstanceName = "uploadfileurl"; //定义删除文件按钮 uploadfiledelete.Text = "删除"; uploadfiledelete.ClientInstanceName = "uploadfiledelete"; uploadfiledelete.ClientEnabled = false; uploadfiledelete.ClientSideEvents.Click = "function(s, e) { uploadfiledeletefunc(); }"; //callback回传服务器删除文件 callbackfiledelete.ClientInstanceName = "callbackdeletefile"; callbackfiledelete.Callback += new CallbackEventHandler(OnCallbackDeleteFile); panel.Controls.Add(new LiteralControl("<table><tr><td>")); panel.Controls.Add(uploadfile); panel.Controls.Add(new LiteralControl("</td><td>")); panel.Controls.Add(uploadfilebutton); panel.Controls.Add(new LiteralControl("</td></tr><tr><td>")); panel.Controls.Add(uploadfileurl); panel.Controls.Add(new LiteralControl("</td><td>")); panel.Controls.Add(uploadfiledelete); panel.Controls.Add(new LiteralControl("</td></tr></table>")); panel.Controls.Add(callbackfiledelete); return(panel); }
protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { string xpath = string.Format("//items/item[@id='{0}']", e.Parameter); XmlNode node = XmlDataSource2.GetXmlDocument().SelectSingleNode(xpath); if (node != null) { LargeImage.ImageUrl = "Images/" + node.Attributes["FileName"].Value; LargeImage.AlternateText = node.Attributes["Text"].Value; LargeImageText.Text = node.Attributes["Text"].Value; } e.Result = ASPxCallback.GetRenderResult(ImagePanel); }
protected override object CreateControlsCore(){ var panel = new Panel(); _callback = new ASPxCallback{ ID = ObjectTypeInfo.Type.Name + "aspxCallback1", ClientInstanceName = ObjectTypeInfo.Type.Name + "_callback1" }; _callback.Callback += callback_Callback; panel.Controls.Add(_callback); var grid = (ASPxGridView) base.CreateControlsCore(); grid.HtmlDataCellPrepared += grid_HtmlDataCellPrepared; panel.Controls.Add(grid); return panel; }
protected override object CreateControlsCore() { var panel = new Panel(); _callback = new ASPxCallback { ID = ObjectTypeInfo.Type.Name + "aspxCallback1", ClientInstanceName = ObjectTypeInfo.Type.Name + "_callback1" }; _callback.Callback += callback_Callback; panel.Controls.Add(_callback); var grid = (ASPxGridView)base.CreateControlsCore(); grid.HtmlDataCellPrepared += grid_HtmlDataCellPrepared; panel.Controls.Add(grid); return(panel); }
protected void ASPxCallback1_Callback(object source, DevExpress.Web.CallbackEventArgs e) { try { ASPxCallback cb = source as ASPxCallback; List <MenuItemFunction> lstMenu = new List <MenuItemFunction>(); foreach (TreeListNode item in trl.GetSelectedNodes()) { MenuItemFunction item1 = new MenuItemFunction(); item1.Item_ID = item.Key; lstMenu.Add(item1); } ctlRole.insertMenuItemRoles(lstMenu, Convert.ToInt32(this.IdRole)); Utils.notifierCallBack(cb, Constant.NOTIFY_SUCCESS, "Lưu chức năng cho role thành công."); } catch (Exception ex) { Utils.notifierPage(Page, this.GetType(), Constant.NOTIFY_FAILURE, ex.Message + " " + ex.StackTrace, Constant.TIME_ERROR); } }
public override System.Web.UI.Control Build() { base.Build(); ASPxPanel panel = new ASPxPanel(); ASPxUploadControl upload = new ASPxUploadControl(); ASPxButton uploadbotton = new ASPxButton(); ASPxLabel uploadurl = new ASPxLabel(); ASPxButton clippingbutton = new ASPxButton(); ASPxButton previewbutton = new ASPxButton(); ASPxButton clippingWH = new ASPxButton(); ASPxButton clippingSubmit = new ASPxButton(); ASPxButton clippingCancel = new ASPxButton(); ASPxPopupControl clipping = new ASPxPopupControl(); ASPxPopupControl preview = new ASPxPopupControl(); ASPxCallback callbackpic = new ASPxCallback(); ASPxLabel uploadfinishname = new ASPxLabel(); ASPxButton imagedelete = new ASPxButton(); ASPxCallback callbackdelete = new ASPxCallback(); ASPxHiddenField picturehf = new ASPxHiddenField(); //定义upload upload.ClientInstanceName = "upload"; upload.ShowProgressPanel = true; upload.BrowseButton.Text = "浏览"; upload.FileUploadComplete += new EventHandler <FileUploadCompleteEventArgs>(uc_FileUploadComplete); //upload.ClientSideEvents.FilesUploadComplete = "function(s, e) { Uploader_PicturesUploadComplete(e); }"; upload.ClientSideEvents.FileUploadComplete = "function(s, e) { Uploader_PictureUploadComplete(e); }"; upload.ClientSideEvents.FileUploadStart = "function(s, e) { Uploader_PictureUploadStart(); }"; upload.ClientSideEvents.TextChanged = "function(s, e) { PictureUpdateUploadButton(); }"; upload.ValidationSettings.MaxFileSize = 4194304; string[] fileExtensions = new string[4] { ".jpg", ".jpeg", ".jpe", ".gif" }; upload.ValidationSettings.AllowedFileExtensions = fileExtensions; //定义上传按钮 uploadbotton.AutoPostBack = false; uploadbotton.Text = "上传"; uploadbotton.ClientInstanceName = "uploadpicturebotton"; uploadbotton.ClientEnabled = false; uploadbotton.ClientSideEvents.Click = "function(s, e) { imagedelete();upload.Upload();}"; //定义剪裁按钮 clippingbutton.AutoPostBack = false; clippingbutton.Text = "剪裁"; clippingbutton.ClientInstanceName = "clippingbutton"; clippingbutton.ClientEnabled = false; clippingbutton.ClientSideEvents.Click = "function(s, e) { clipping();initialization();}"; //弹出的剪裁窗口定义 clipping.CloseAction = CloseAction.CloseButton; clipping.Modal = true; clipping.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter; clipping.PopupVerticalAlign = PopupVerticalAlign.WindowCenter; clipping.ClientInstanceName = "clippingview"; clipping.HeaderText = "图片剪裁"; clipping.AllowDragging = true; clipping.EnableAnimation = false; clipping.EnableViewState = false; clipping.MinWidth = 500; clipping.MinHeight = 400; clipping.ClientSideEvents.CloseButtonClick = "function(s, e) { destroy();}"; clipping.ClientSideEvents.Init = "function(s, e){s.hideBodyScrollWhenModal = false;}"; //弹出剪裁窗口中的控件定义 clippingWH.AutoPostBack = false; clippingWH.Text = "更改长宽"; clippingWH.ClientSideEvents.Click = "function(s, e) { clippingWHclick();}"; clippingSubmit.AutoPostBack = false; clippingSubmit.Text = "剪裁"; clippingSubmit.ClientSideEvents.Click = "function(s, e) { clippingSubmit();}"; //callback接收剪裁数据 callbackpic.ClientInstanceName = "callbackpic"; callbackpic.Callback += new CallbackEventHandler(OnCallbackComplete); callbackpic.ClientSideEvents.CallbackComplete = "function(s, e) { CallbackComplete(e);}"; clippingCancel.AutoPostBack = false; clippingCancel.Text = "取消"; clippingCancel.ClientSideEvents.Click = "function(s, e) { clippingview.Hide();destroy();}"; clipping.Controls.Add(new LiteralControl("<table><tr><td>")); clipping.Controls.Add(new LiteralControl("<img src='' id='clippingpicture' alt='' />")); clipping.Controls.Add(new LiteralControl("</td><td>")); clipping.Controls.Add(new LiteralControl("<div style='width:150px;height:150px;overflow:hidden;' id='divsmall'>")); clipping.Controls.Add(new LiteralControl("<img src='' id='small' alt='' />")); clipping.Controls.Add(new LiteralControl("</div></td></tr></table>")); clipping.Controls.Add(new LiteralControl("<br />")); clipping.Controls.Add(new LiteralControl("<table><tr><td colspan='6'>可自定义框体长宽:</td>")); clipping.Controls.Add(new LiteralControl("<tr><td><label>X1 <input type='text' size='4' id='x1' name='x1' readonly='readonly' /></label></td>")); clipping.Controls.Add(new LiteralControl("<td><label>Y1 <input type='text' size='4' id='y1' name='y1' readonly='readonly' /></label></td>")); clipping.Controls.Add(new LiteralControl("<td><label>X2 <input type='text' size='4' id='x2' name='x2' readonly='readonly' /></label></td>")); clipping.Controls.Add(new LiteralControl("<td><label>Y2 <input type='text' size='4' id='y2' name='y2' readonly='readonly' /></label></td>")); clipping.Controls.Add(new LiteralControl("<td><label>W <input type='text' size='4' id='w' name='w' /></label></td>")); clipping.Controls.Add(new LiteralControl("<td><label>H <input type='text' size='4' id='h' name='h' /></label></td></tr>")); clipping.Controls.Add(new LiteralControl("<tr><td colspan='4'></td>")); clipping.Controls.Add(new LiteralControl("<td colspan='2' align='middle'>")); clipping.Controls.Add(clippingWH); clipping.Controls.Add(new LiteralControl("</td></tr>")); clipping.Controls.Add(new LiteralControl("<tr><td>")); clipping.Controls.Add(clippingSubmit); clipping.Controls.Add(new LiteralControl("</td>")); clipping.Controls.Add(new LiteralControl("<td>")); clipping.Controls.Add(clippingCancel); clipping.Controls.Add(new LiteralControl("</td>")); clipping.Controls.Add(new LiteralControl("<td>")); clipping.Controls.Add(new LiteralControl("<input type='checkbox' id='ar_lock'/><label for='ar_lock'>比例固定</label>")); clipping.Controls.Add(new LiteralControl("</td>")); clipping.Controls.Add(new LiteralControl("<td colspan='5'></td></tr></table>")); //定义Label uploadurl.Text = "";//文件名 uploadurl.ClientInstanceName = "uploadurl"; //定义预览按钮 previewbutton.AutoPostBack = false; previewbutton.Text = "预览"; previewbutton.ClientInstanceName = "previewbutton"; previewbutton.ClientEnabled = false; previewbutton.ClientSideEvents.Click = "function(s, e) { preview(); }"; //弹出的预览窗口定义 preview.CloseAction = CloseAction.CloseButton; preview.Modal = true; preview.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter; preview.PopupVerticalAlign = PopupVerticalAlign.WindowCenter; preview.ClientInstanceName = "previewview"; preview.HeaderText = "图片预览"; preview.AllowDragging = true; preview.EnableAnimation = false; preview.EnableViewState = false; preview.Controls.Add(new LiteralControl("<img id='previewpicture' alt='' src=''")); preview.ClientSideEvents.Init = "function(s, e){s.hideBodyScrollWhenModal = false;}"; //定义上传后保存的文件名。uploadfinishname uploadfinishname.Text = ""; uploadfinishname.ClientInstanceName = "uploadfinishname"; //上传后,删除按钮 imagedelete.AutoPostBack = false; imagedelete.Text = "删除"; imagedelete.ClientInstanceName = "imagedeletebutton"; imagedelete.ClientEnabled = false; imagedelete.ClientSideEvents.Click = "function(s, e) { imagedelete(); }"; //点击删除按钮callback服务器删除对应图片 callbackdelete.ClientInstanceName = "callbackdeleteimg"; callbackdelete.Callback += new CallbackEventHandler(OnCallbackDeleteImg); //隐藏控件保存图片地址 picturehf.ClientInstanceName = "picturehf"; panel.Controls.Add(new LiteralControl("<table><tr><td>")); panel.Controls.Add(upload); panel.Controls.Add(new LiteralControl("</td><td>")); panel.Controls.Add(uploadbotton); panel.Controls.Add(new LiteralControl("</td></tr><tr><td>")); panel.Controls.Add(uploadurl); panel.Controls.Add(new LiteralControl("</td><td>")); panel.Controls.Add(clippingbutton); panel.Controls.Add(clipping); panel.Controls.Add(new LiteralControl("</td></tr><tr><td>")); panel.Controls.Add(uploadfinishname); panel.Controls.Add(new LiteralControl("</td><td>")); panel.Controls.Add(imagedelete); panel.Controls.Add(previewbutton); panel.Controls.Add(preview); panel.Controls.Add(new LiteralControl("</td></tr></table>")); panel.Controls.Add(callbackpic); panel.Controls.Add(callbackdelete); panel.Controls.Add(picturehf); return(panel); }
protected override void OnInit(EventArgs e) { base.OnInit(e); Page.RegisterRequiresControlState(this); tbControl = new Table() { CellPadding = 0, CellSpacing = 0 }; TableRow row = new TableRow(); row.Cells.Add(new TableCell() { HorizontalAlign = HorizontalAlign.Left, VerticalAlign = VerticalAlign.Top }); row.Cells.Add(new TableCell() { HorizontalAlign = HorizontalAlign.Left, VerticalAlign = VerticalAlign.Top }); tbControl.Rows.Add(row); tbControl.Rows[0].Cells[1].Attributes.Add("style", "padding-left:2px"); lblCustomerName = new ASPxLabel() { ID = "lblCustomerName", ClientInstanceName = this.ClientID + "_lblCustomerName", }; hddMFCustomers = new ASPxHiddenField() { ID = "hddMFCustomers", ClientInstanceName = this.ClientID + "_hddMFCustomers", }; sqlDataSource = new SqlDataSource() { ID = this.ID + "_sqlDataSource", SelectCommandType = SqlDataSourceCommandType.Text, ConnectionString = base.ConnectionString, DataSourceMode = SqlDataSourceMode.DataSet, EnableCaching = false, EnableViewState = false, }; // CustomerID, CustomerNo, EffectiveFrom, EffectiveTo sqlDataSource.SelectParameters.Add("langCode", TypeCode.String, base.LanguageCode); cbClickGdvRow = new ASPxCallback() { ID = "cbClickGdvRow", ClientInstanceName = this.ClientID + "_cbClickGdvRow", }; cbClickGdvRow.Callback += new CallbackEventHandler(cbClickGdvRow_Callback); bteMFCustomers = new ASPxButtonEdit() { ID = "bteMFCustomers", ClientInstanceName = this.ClientID + "_bteMFCustomers", }; bteMFCustomers.Buttons.Add(new EditButton()); popMFCustomers = new ASPxPopupControl() { ID = "popMFCustomers", ClientInstanceName = this.ClientID + "_popMFCustomers", PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter, PopupVerticalAlign = PopupVerticalAlign.WindowCenter, CloseAction = CloseAction.CloseButton, Modal = true, EnableAnimation = false, HeaderText = "ลูกค้า", AllowDragging = true, AllowResize = true, ResizingMode = ResizingMode.Live, Width = Unit.Pixel(400), }; gdvMFCustomers = new ASPxGridView() { ID = "gdvMFCustomers", ClientInstanceName = this.ClientID + "_gdvMFCustomers", EnableRowsCache = false, EnableViewState = false, DataSourceID = sqlDataSource.ID, AutoGenerateColumns = false, Width = Unit.Percentage(100), }; gdvMFCustomers.SettingsBehavior.ColumnResizeMode = ColumnResizeMode.Control; gdvMFCustomers.SettingsPager.PageSize = 20; gdvMFCustomers.SettingsPager.AlwaysShowPager = true; gdvMFCustomers.Settings.ShowFilterRow = true; gdvMFCustomers.Settings.ShowFilterRowMenu = true; gdvMFCustomers.KeyFieldName = "CustomerID"; GridViewDataColumn column = null; column = new GridViewDataColumn() { Name = "CustomerNO", FieldName = "CustomerNO", Caption = "รหัสลูกค้า", }; column.Settings.AutoFilterCondition = AutoFilterCondition.Contains; column.Settings.FilterMode = ColumnFilterMode.DisplayText; gdvMFCustomers.Columns.Add(column); column = new GridViewDataColumn() { Name = "CustomerName", FieldName = "CustomerName", Caption = "ชื่อลูกค้า", }; column.Settings.AutoFilterCondition = AutoFilterCondition.Contains; column.Settings.FilterMode = ColumnFilterMode.DisplayText; gdvMFCustomers.Columns.Add(column); gdvMFCustomers.HtmlRowCreated += new ASPxGridViewTableRowEventHandler(HandlerMethod.gdvItemListControl_HtmlRowCreated); gdvMFCustomers.CustomCallback += new ASPxGridViewCustomCallbackEventHandler(gdvMFCustomers_CustomCallback); gdvMFCustomers.BeforePerformDataSelect += new EventHandler(gdvMFCustomers_BeforePerformDataSelect); if (MFCustomerType == PartyType.All) { cboType = new ASPxComboBox() { ID = "cboType", ClientInstanceName = this.ClientID + "_cboType", }; cboType.ValueType = typeof(int); cboType.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith; } }
public static void JsMessage(ASPxCallback panel, StringBuilder message, int warningCount) { panel.JSProperties["cpIsError"] = warningCount > 0; panel.JSProperties["cpErrorMessage"] = message.ToString(); }
protected void ASPxCallback1_Callback(object source, CallbackEventArgs e) { var control = getCreateHintContent(e.Parameter); e.Result = ASPxCallback.GetRenderResult(control); }
public static void notifierCallBack(ASPxCallback cb, String status, String content) { cb.JSProperties["cpUpdateStatus"] = status; cb.JSProperties["cpMess"] = content; }