Ejemplo n.º 1
0
        private void AddUpdatePanel(Panel p)
        {
            this.messageLabel = new Label();

            this.updatePanel = new UpdatePanel();
            this.updatePanel.ID = "ScrudUpdatePanel";
            this.updatePanel.ChildrenAsTriggers = true;
            this.updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;

            this.updatePanel.ContentTemplateContainer.Controls.Add(this.topCommandPanel.GetCommandPanel("top"));
            this.updatePanel.ContentTemplateContainer.Controls.Add(this.messageLabel);
            this.updatePanel.ContentTemplateContainer.Controls.Add(this.gridPanel);
            this.updatePanel.ContentTemplateContainer.Controls.Add(this.formPanel);
            this.updatePanel.ContentTemplateContainer.Controls.Add(this.bottomCommandPanel.GetCommandPanel("bottom"));

            //Bottom command panel.
            this.userIdHidden = new HiddenField();
            this.userIdHidden.ID = "UserIdHidden";
            this.userIdHidden.Value = this.UserId.ToString(CultureInfo.InvariantCulture);

            this.officeCodeHidden = new HiddenField();
            this.officeCodeHidden.ID = "OfficeCodeHidden";
            this.officeCodeHidden.Value = this.OfficeCode;

            this.updatePanel.ContentTemplateContainer.Controls.Add(this.userIdHidden);
            this.updatePanel.ContentTemplateContainer.Controls.Add(this.officeCodeHidden);
            p.Controls.Add(this.updatePanel);
        }
Ejemplo n.º 2
0
 private void UpdateToolTip(string elementID, UpdatePanel panel)
 {
     Control ctrl = Page.LoadControl("SampleControl1.ascx");
     panel.ContentTemplateContainer.Controls.Add(ctrl);
     SampleControl1 details = (SampleControl1)ctrl;
     details.ProductID = elementID;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls 
        /// that use composition-based implementation to create any child controls
        /// they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            m_MainPanel = new UpdatePanel();
            m_MainPanel.RenderMode = UpdatePanelRenderMode.Inline;

            // The next two lines ensure that nothing is sent to the client,
            // as there's no information to send anyway. This reduces overhead.
            m_MainPanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
            m_MainPanel.ChildrenAsTriggers = false;

            Controls.Add(m_MainPanel);

            m_TypeBox = new TextBox();
            m_TypeBox.ID = "Type";
            m_TypeBox.EnableViewState = false;
            m_TypeBox.ValidationGroup = "Communicator";
            m_MainPanel.ContentTemplateContainer.Controls.Add(m_TypeBox);

            m_MessageBox = new TextBox();
            m_MessageBox.ID = "Message";
            m_MessageBox.EnableViewState = false;
            m_MessageBox.ValidationGroup = "Communicator";
            m_MainPanel.ContentTemplateContainer.Controls.Add(m_MessageBox);

            m_SubmitButton = new Button();
            m_SubmitButton.ID = "Submit";
            m_MessageBox.EnableViewState = false;
            m_SubmitButton.ValidationGroup = "Communicator";
            m_SubmitButton.Click += new EventHandler(SubmitButton_Click);
            m_MainPanel.ContentTemplateContainer.Controls.Add(m_SubmitButton);

        }
Ejemplo n.º 4
0
        // Events /////////////////////////////////////////////////////////
        protected override void CreateChildControls()
        {
            Controls.Clear();
            UIControls.ErrorMessage.Text = string.Empty;

            _masterUpdatePanel = new UpdatePanel();
            _masterUpdatePanel.ID = "ImportExportUpdatePanel";
            _masterUpdatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;

            _masterUpdatePanel.ContentTemplateContainer.Controls.Clear();

            switch (PortletMode)
            {
                case ImportExportPortletState.Import:
                    CreateImportControls();
                    SetImportPostBackButton();
                    break;
                case ImportExportPortletState.Export:
                    CreateExportControls();
                    break;
                default:
                    CreateImportControls();
                    SetImportPostBackButton();
                    CreateExportControls();
                    CreateToolbar();
                    break;
            }


            Controls.Add(_masterUpdatePanel);

            ChildControlsCreated = true;
        }
Ejemplo n.º 5
0
    }//end string

    public static bool VerificaArrayTextBox_SoloMayMinNum(System.Web.UI.UpdatePanel up, String oReplace, params TextBox[] textbox)
    {
        //Valida formato del Concepto (Obligatorio)        
        Regex oRegex = new Regex("^[a-zA-Z0-9 ]+$");

        for (int x = 0; x <= textbox.Length - 1; x++)
        {
            if (!string.IsNullOrEmpty(textbox[x].Text))
            {
                if (oRegex.Match(textbox[x].Text).Success == false)
                {
                    WebMsgBox.MuestraMensajeAJAX(up, "Introduzca sólo números en el campo " + textbox[x].ID.Replace(oReplace, String.Empty));
                    return false;
                }
            }
            else
            {
                return true;

            }//end if

        }//end for            

        return true;

    }//end string
Ejemplo n.º 6
0
        protected override void CreateChildControls() {
            base.CreateChildControls();

            Control parent;
            Control container;

            // Get a reference to the ScriptManager object for the page
            // if one exists.
            ScriptManager sm = ScriptManager.GetCurrent(Page);

            if (sm == null || !sm.EnablePartialRendering)
            {
                // If partial rendering is not enabled, set the parent
                // and container as a basic control. 
                container = new Control();
                parent = container;
            }
            else
            {
                // If partial rendering is enabled, set the parent as
                // a new UpdatePanel object and the container to the 
                // content template of the UpdatePanel object.
                UpdatePanel up = new UpdatePanel();
                container = up.ContentTemplateContainer;
                parent = up;
            }

            AddDataboundControls(container);

            Controls.Add(parent);
        }
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            Control parent;
            Control container;

            UpdatePanel up = new UpdatePanel();
            container = up.ContentTemplateContainer;
            parent = up;

            //Doctype picker
            picker = (DropDownList)new DocTypePicker().RenderControl();
            picker.AutoPostBack = true;
            picker.SelectedIndexChanged += new EventHandler(picker_SelectedIndexChanged);
            picker.ID = "doctypepicker";

            locationPicker.ID = "locationpicker";
            locationPicker.AutoPostBack = true;

            p_items.CssClass = "docMapper";
            p_items.Visible = false;

            container.Controls.Add(picker);
            container.Controls.Add(p_items);
            container.Controls.Add(locationPicker);
            Controls.Add(parent);
        }
Ejemplo n.º 8
0
 protected void RegisterUpdatePanel(UpdatePanel panel)
 {
     var sType = typeof(ScriptManager);
     var mInfo = sType.GetMethod("System.Web.UI.IScriptManagerInternal.RegisterUpdatePanel", BindingFlags.NonPublic | BindingFlags.Instance);
     if (mInfo != null)
         mInfo.Invoke(ScriptManager.GetCurrent(Page), new object[] { panel });
 }
 internal RegisteredDisposeScript(Control control, string disposeScript, UpdatePanel parentUpdatePanel) {
     Debug.Assert(control != null);
     Debug.Assert(disposeScript != null);
     Debug.Assert(parentUpdatePanel != null);
     _control = control;
     _script = disposeScript;
     _parentUpdatePanel = parentUpdatePanel;
 }
Ejemplo n.º 10
0
 public void AjaxStartupScript(UpdatePanel control)
 {
     ScriptManager.RegisterClientScriptBlock(
         control,
         this.GetType(),
         "key",
         GetScript(),
         true);
 }
Ejemplo n.º 11
0
 public UpdatePanel CreateUpdatePanel(string Prefix, UpdatePanelUpdateMode Upm, int PaneUpdatePanelCount)
 {
     UpdatePanel udp = new UpdatePanel();
     udp.UpdateMode = Upm;
     PaneUpdatePanelCount++;
     udp.ID = "_udp_" + "_" + PaneUpdatePanelCount + Prefix;
     //udp.EnableViewState = true;
     return udp;
 }
Ejemplo n.º 12
0
 public void HideAjaxinit(UpdatePanel up)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append(" <script language=JavaScript type=text/javascript>");
     sb.Append(" if( document.getElementById('loader_container')) document.getElementById('loader_container').style.display='none';");
     sb.Append("</script>");
     ScriptManager.RegisterClientScriptBlock(up, typeof(UpdatePanel), "Progress", sb.ToString(), false);
     //HttpContext.Current.Response.Flush();
 }
Ejemplo n.º 13
0
        private void UpdateToolTip(string elementID, UpdatePanel panel)
        {
           
                Control ctrl = Page.LoadControl("~/user-controls/footer.ascx");
                panel.ContentTemplateContainer.Controls.Add(ctrl);
                // ProductDetails details = (ProductDetails)ctrl;
                //details.ProductID = elementID;
            

        }
 void p_Init(object sender, EventArgs e)
 {
    if(IsInAjaxMode())
    {
        up = new UpdatePanel();
        up.ID = UpdatePanelId;
        up.UpdateMode = UpdatePanelUpdateMode.Always;
        page.Form.Controls.Add(up);
    }
 }
Ejemplo n.º 15
0
    public static void Confirmacion(string Mensaje, System.Web.UI.UpdatePanel Panel, string BotonNombreYES, string BotonNombreNO = "")
    {
        string Script = @"Sexy.confirm('" + Mensaje + "', {onComplete:" +
                        "  function(returnvalue) { " +
                        "  if(returnvalue)" +
                        "  {              " +
                        "      document.getElementById('" + BotonNombreYES + "').click();" +
                        "  }          " + (BotonNombreNO != "" ? " else{document.getElementById('" + BotonNombreNO + "').click(); }" : "") +
                        "  }});";

        System.Web.UI.ScriptManager.RegisterStartupScript(Panel, typeof(string), "alerta", Script, true);
    }
Ejemplo n.º 16
0
 public static void AddSPNotification(UpdatePanel updSettings, string text, bool isRefresh)
 {
     if (String.IsNullOrEmpty(text) == false)
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendLine(string.Format("SP.UI.Notify.addNotification(\"{0}\");", text));
         if (isRefresh == true)
         {
             stringBuilder.AppendLine("SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, 1);");
             stringBuilder.AppendLine("window.frameElement.commitPopup();");
         }
         ScriptManager.RegisterClientScriptBlock(updSettings, updSettings.GetType(), Guid.NewGuid().ToString(), stringBuilder.ToString(), true);
     }
 }
Ejemplo n.º 17
0
        public void AddControlToBody_WithOtherControl_AddsControlToBodyControl()
        {
            // arrange
            var updatePanel = new UpdatePanel();
            var control = new UserControl();
            var bodyControl = new UserControl();
            var page = new SubtextMasterPage();

            // act
            page.AddControlToBody("Other", control, updatePanel, bodyControl);

            // assert
            Assert.AreEqual(control, bodyControl.Controls[0]);
        }
Ejemplo n.º 18
0
        public void AddControlToBody_WithComments_AddsControlToUpdatePanel()
        {
            // arrange
            var updatePanel = new UpdatePanel();
            var control = new UserControl {Visible = false};
            var bodyControl = new UserControl();
            var page = new SubtextMasterPage();

            // act
            page.AddControlToBody("Comments", control, updatePanel, bodyControl);

            // assert
            Assert.AreEqual(control, updatePanel.ContentTemplateContainer.Controls[0]);
            Assert.IsTrue(control.Visible);
        }
Ejemplo n.º 19
0
		internal void InitOverviewGrid(UpdatePanel targetContainer)
		{
			_grdOrders = new GridView {CellPadding = 5, AllowSorting = true, CssClass = "uwbsOrderGridView"};

			const string alternatingRowStylehexValue = "#eeeeee";
			_grdOrders.AlternatingRowStyle.BackColor = ColorTranslator.FromHtml(alternatingRowStylehexValue);

			_grdOrders.RowDataBound += GrdOrdersOnRowDataBound;
			_grdOrders.Sorting += GrdOrdersOnSorting;
			_grdOrders.PageIndexChanging += GrdOrdersOnPageIndexChanging;
			_grdOrders.ShowHeader = true;

			BindData();
			targetContainer.ContentTemplateContainer.Controls.Add(_grdOrders); //targetContainer.Controls.Add(_grdOrders);
		}
Ejemplo n.º 20
0
        public void AddControlToBody_WithPostComment_AddsControlToUpdatePanelAndUpdatePanelToCenterBodyControl()
        {
            // arrange
            var updatePanel = new UpdatePanel();
            var postCommentControl = new PostComment();
            var bodyControl = new UserControl();
            var page = new SubtextMasterPage();

            // act
            page.AddControlToBody("PostComment", postCommentControl, updatePanel, bodyControl);

            // assert
            Assert.AreEqual(postCommentControl, updatePanel.ContentTemplateContainer.Controls[0]);
            Assert.AreEqual(updatePanel, bodyControl.Controls[0]);
            Assert.IsTrue(postCommentControl.Visible);
        }
 // -----------------------------------------------------------------------------
 // <summary>
 // Register Control buttonCtrl with ScriptManager to perform traditional postback instead of default async postback
 // </summary>
 // <remarks>
 // </remarks>
 // <history>
 //  [sramarao]	3/2007	Created
 // </history>
 // -----------------------------------------------------------------------------
 public virtual void RegisterPostBackTrigger(System.Web.UI.Control buttonCtrl, System.Web.UI.Control updatePanelCtrl)
 {
     try
     {
         // Get current ScriptManager
         ScriptManager             scriptMgr          = ScriptManager.GetCurrent(this.Page);
         System.Web.UI.UpdatePanel CurrentUpdatePanel = (UpdatePanel)updatePanelCtrl;
         // If Scriptmanager not preset return.
         // If buttonCtrl is not surrounded by an UpdatePanel then return.
         if (scriptMgr != null && CurrentUpdatePanel != null && buttonCtrl != null)
         {
             scriptMgr.RegisterPostBackControl(buttonCtrl);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 22
0
    static public void JQMensaje(System.Web.UI.UpdatePanel Panel, string Mensaje, TipoMensaje Tipo = TipoMensaje.Informacion, string Caption = "Información del sistema", string AlterScript = "")
    {
        string Script = "";

        switch (Tipo)
        {
        case TipoMensaje.Informacion:
            Script = "Sexy.info"; break;

        case TipoMensaje.Alerta:
            Script = "Sexy.alert"; break;

        case TipoMensaje.Error:
            Script = "Sexy.error"; break;
        }

        Script = Script + "('<h1>" + Caption + "</h1><p>" + Mensaje + "</p>');";
        System.Web.UI.ScriptManager.RegisterStartupScript(Panel, typeof(string), "Mensaje", Script + ' ' + AlterScript, true);
    }
Ejemplo n.º 23
0
        private void AddUpdatePanel(Panel p)
        {
            updatePanel = new UpdatePanel();
            updatePanel.ID = "ScrudUpdatePanel";
            updatePanel.ChildrenAsTriggers = true;
            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;

            updatePanel.ContentTemplateContainer.Controls.Add(this.topCommandPanel.GetCommandPanel());
            updatePanel.ContentTemplateContainer.Controls.Add(this.messageLabel);
            updatePanel.ContentTemplateContainer.Controls.Add(this.gridPanel);
            updatePanel.ContentTemplateContainer.Controls.Add(this.formPanel);
            updatePanel.ContentTemplateContainer.Controls.Add(this.bottomCommandPanel.GetCommandPanel()); //Bottom command panel.

            userIdHidden = new HiddenField();
            officeCodeHidden = new HiddenField();

            updatePanel.ContentTemplateContainer.Controls.Add(userIdHidden);
            updatePanel.ContentTemplateContainer.Controls.Add(officeCodeHidden);
            p.Controls.Add(updatePanel);
        }
Ejemplo n.º 24
0
        protected override int CreateChildControls(System.Collections.IEnumerable dataSource, bool dataBinding)
        {
            if (this.WrapControl != null)
            {
                UpdatePanel up = new UpdatePanel();

                up.ID = String.Format("up_{0}", this.WrapControl.ID);
                up.ChildrenAsTriggers = true;
                up.EnableViewState = true;
                up.UpdateMode = UpdatePanelUpdateMode.Conditional;
                up.ContentTemplateContainer.Controls.Add(this.WrapControl);

                this.Controls.Add(up);
                //this.LoadViewState(HttpContext.Current.Request.Form["__VIEWSTATE"]);
                return 1;
            }
            else
            {
                return 0;
            }
        }
Ejemplo n.º 25
0
        protected void exibirMensagem(UpdatePanel painel, String titulo, String mensagem, String tipo)
        {
            String img = "";
            switch (tipo)
            {
                case "erro": img = "img/ico_error.png"; break;
                case "alerta": img = "img/ico_alert.png"; break;
                case "info": img = "img/ico_info.png"; break;
                case "ok": img = "img/ico_success.png"; break;
            }

            img = "<div class=\"row\"><div class=\"col-md-2\"><img src=\"" + img + "\" /></div>";
            mensagem = "<div class=\"col-md-6\">" + mensagem + "</div></div>";

            String comando = "$('#modalRespostaBody').html(' " + img + mensagem + "');";
            comando += "$('#modalRespostaLabel').html('" + titulo + "');";
            comando += "$('#modalResposta').modal('show');";
            //comando += "$('#modalResposta').on('hide', function(){$('#modalResumo').modal('hide');});";

            ScriptManager.RegisterClientScriptBlock(painel, typeof(Page), "modal", comando, true);
        }
Ejemplo n.º 26
0
        public void initAjaxJavascript(UpdatePanel up)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<script language=JavaScript type=text/javascript>");
            sb.Append("var t_id = setInterval(animate,20);");
            sb.Append("var pos=0;var dir=2;var len=0;");
            sb.Append("function animate(){");
            sb.Append("var elem = document.getElementById('progress');");
            sb.Append("if(elem != null) {");
            sb.Append("if (pos==0) len += dir;");
            sb.Append("if (len>32 || pos>79) pos += dir;");
            sb.Append("if (pos>79) len -= dir;");
            sb.Append(" if (pos>79 && len==0) pos=0;");
            sb.Append("elem.style.left = pos;");
            sb.Append("elem.style.width = len;");
            sb.Append("}}");
            sb.Append("function remove_loading() {");
            sb.Append(" this.clearInterval(t_id);");
            sb.Append("var targelem = document.getElementById('loader_container');");
            sb.Append("targelem.style.display='none';");
            sb.Append("targelem.style.visibility='hidden';");
            sb.Append("}");
            sb.Append("</script>");
            sb.Append("<style>");
            sb.Append("#loader_container {text-align:center; position:absolute; top:40%; width:100%; left: 0;}");
            sb.Append("#loader {font-family:Tahoma, Helvetica, sans; font-size:11.5px; color:#000000; background-color:#FFFFFF; padding:10px 0 16px 0; margin:0 auto; display:block; width:130px; border:1px solid #5a667b; text-align:left; z-index:2;}");
            sb.Append("#progress {height:5px; font-size:1px; width:1px; position:relative; top:1px; left:0px; background-color:#8894a8;}");
            sb.Append("#loader_bg {background-color:#e4e7eb; position:relative; top:8px; left:8px; height:7px; width:113px; font-size:1px;}");
            sb.Append("</style>");
            sb.Append("<div id=loader_container>");
            sb.Append("<div id=loader>");
            sb.Append("<div align=center>页面正在加载中 ...</div>");
            sb.Append("<div id=loader_bg><div id=progress> </div></div>");
            sb.Append("</div></div>");
            ScriptManager.RegisterClientScriptBlock(up, typeof(UpdatePanel), "Progress", sb.ToString(), false);

            //HttpContext.Current.Response.Flush();
        }
Ejemplo n.º 27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // create an update panel
            UpdatePanel updatepanel = new UpdatePanel();

            // add the update panel to the placeholder
            LocalPlaceHolder.Controls.Add(updatepanel);

            // create a label to show time
            m_TimeLabel = new Label();
            m_TimeLabel.Text = DateTime.Now.ToString();

            // add the label to the update panel
            updatepanel.ContentTemplateContainer.Controls.Add(m_TimeLabel);

            // create a drop down list
            DropDownList dropdown = new DropDownList();
            dropdown.ID = "Dropdown1";
            dropdown.AutoPostBack = true; // this is absolutely required
            dropdown.Items.Add("Item 1");
            dropdown.Items.Add("Item 2");
            dropdown.Items.Add("Item 3");
            dropdown.Items.Add("Item 4");

            // add the drop down list to the update panel
            updatepanel.ContentTemplateContainer.Controls.Add(dropdown);

            // create a trigger
            AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();

            // associate the trigger with the drop down
            trigger.ControlID = "Dropdown1";
            trigger.EventName = "SelectedIndexChanged";

            // add the trigger to the update panel
            updatepanel.Triggers.Add(trigger);
        }
Ejemplo n.º 28
0
        protected override void OnInit(EventArgs e)
        {
            _ddlDay = new DropDownList() { ID = "dobDay",DataTextField="Value", DataValueField="Key"};
            _ddlMonth = new DropDownList() { ID = "dobMonth", AutoPostBack = true, DataTextField = "MonthName", DataValueField = "MonthNumber" };
            _ddlYear = new DropDownList() { ID = "dobYear", DataTextField = "Value", DataValueField = "Key", AutoPostBack = true };
            _ddlMonth.DataSource = Enumerable.Range(1, 12).Select(a => new { MonthName = DateTimeFormatInfo.CurrentInfo.GetMonthName(a), MonthNumber = a });
            _ddlMonth.DataBind();
            int year = Convert.ToInt32(DateTime.UtcNow.ToString("yyyy"));
            int month = Convert.ToInt32(DateTime.UtcNow.ToString("MM"));
            _ddlYear.DataSource = Enumerable.Range(year - 99, 100).Reverse().Select(y => new { Key = y, Value = Common.TranslateNumerals(y) });
            _ddlYear.DataBind();
            _ddlDay.DataSource = Enumerable.Range(1, DateTime.DaysInMonth(year, month)).Select(d => new { Key = d, Value = Common.TranslateNumerals(d) });
            _ddlDay.DataBind();
            _ddlMonth.SelectedIndexChanged += MonthChanged;
            _ddlYear.SelectedIndexChanged += YearChanged;

            _ddlYear.Style.Add("margin-right","0.5em");
            _ddlMonth.Style.Add("margin-right", "0.5em");

            UpdatePanel updPnl = new UpdatePanel
                                 {
                                     ID = "dateUpdate",
                                     ChildrenAsTriggers = true,
                                     UpdateMode = UpdatePanelUpdateMode.Conditional,
                                     RenderMode = UpdatePanelRenderMode.Inline
                                 };

            updPnl.ContentTemplateContainer.Controls.Add(_ddlYear);
            updPnl.ContentTemplateContainer.Controls.Add(_ddlMonth);
            updPnl.ContentTemplateContainer.Controls.Add(_ddlDay);

            this.Controls.Add(updPnl);

            this.Attributes.Add("style","width:auto;display:inline-block;");
            ValidateControl = _ddlYear;
        }
Ejemplo n.º 29
0
    public static void Show(this System.Web.UI.UserControl ctl, System.Web.UI.UpdatePanel udPnl, string Message)
    {
        string Script = @"alert('{0}');"; // 注意,有經過String.Format的話大括號要重複

        System.Web.UI.ScriptManager.RegisterClientScriptBlock(udPnl, udPnl.GetType(), "Message", String.Format(Script, Message.Replace("\r\n", "\\n").Replace("'", "\\'").Replace("\"", "\\\"")), true);
    }
        protected void fillGuideDetailsEditMode(GridView gv, UpdatePanel uppanel)
        {
            //Bind the grid.

            ds = objTransportPriceListGIT.bindGuideGrid(GitTransferPackageId);
            gridGuide.DataSource = ds;
            gridGuide.DataBind();
        }
        protected void fillTransferPackageDetailsEditMode(GridView gv, UpdatePanel uppanel)
        {
            DataSet dtTransferPackage = objTransportPriceListGIT.fetchTransferPriceListDataForEdit(GitTransferPackageId);
            for (int j = 0; j < dtTransferPackage.Tables[0].Rows.Count; j++)
            {
                foreach (GridViewRow item in gv.Rows)
                {
                    if (j == item.DataItemIndex)
                    {
                        //  String city = dtCities.Tables[0].Rows[i]["CITY_NAME"].ToString();

                        DropDownList drpFrom = (DropDownList)item.FindControl("drpFrom");
                        DropDownList drpTo = (DropDownList)item.FindControl("drpTo");

                        drpFrom.Text = dtTransferPackage.Tables[0].Rows[j]["FROM_NAME"].ToString();
                        drpTo.Text = dtTransferPackage.Tables[0].Rows[j]["TO_NAME"].ToString();

                    }

                }
                if (j < dtTransferPackage.Tables[0].Rows.Count - 1)
                {
                    AddTransferDetails(gv, uppanel);
                }
            }

        }
        protected void AddTransferDetails(GridView gv, UpdatePanel uppanel)
        {
            int count = gv.Rows.Count;
            int count1 = count + 1;
            DataTable dt = new DataTable();

            //   DataSet ds = objGitDetail.fetchComboDataforHotel("FETCH_HOTEL_NAME_FOR_GIT_CITY_WISE", CityName, "01/09/2012", "11/09/2012");



            foreach (GridViewRow item in gv.Rows)
            {
                DropDownList drpFrom = (DropDownList)item.FindControl("drpFrom");
                DropDownList drpTo = (DropDownList)item.FindControl("drpTo");


                if (dt.Columns.Count == 0)
                {
                    dt.Columns.Add("From");
                    dt.Columns.Add("To");


                }

                DataRow dr = dt.NewRow();
                dr["From"] = drpFrom.Text;
                dr["To"] = drpTo.Text;

                dt.Rows.Add(dr);

            }

            if (count == 0)
            {
                if (dt.Columns.Count == 0)
                {
                    dt.Columns.Add("From");
                    dt.Columns.Add("To");

                }

                DataRow dr = dt.NewRow();
                dr["From"] = "";
                dr["To"] = "";

                dt.Rows.Add(dr);
                gv.DataSource = dt;
                gv.DataBind();
                uppanel.Update();
            }

            if (count != 0)
            {

                DataRow dr1 = dt.NewRow();

                dt.Rows.Add(dr1);


            }

            gv.DataSource = dt;
            gv.DataBind();


            foreach (GridViewRow item in gv.Rows)
            {
                int itm = item.DataItemIndex;
                DropDownList drpFrom = (DropDownList)item.FindControl("drpFrom");
                DropDownList drpTo = (DropDownList)item.FindControl("drpTo");

                for (int k = 0; k < dt.Rows.Count; k++)
                {
                    if (itm == k)
                    {
                        DataSet ds = objTransportPriceListGIT.fetchComboData("FETCH_ALL_TRANSFER_PACKAGE_NAME_AUTOSERACH");
                        binddropdownlist(drpFrom, ds);
                        binddropdownlist(drpTo, ds);
                        drpFrom.Text = dt.Rows[itm]["From"].ToString();
                        drpTo.Text = dt.Rows[itm]["To"].ToString();

                    }
                }
            }
            uppanel.Update();

        }
Ejemplo n.º 33
0
        /// <summary>
        /// Adds icons to the configuration area of a block instance.  Can be overridden to
        /// add additionsl icons
        /// </summary>
        /// <param name="canConfig"></param>
        /// <param name="canEdit"></param>
        /// <returns></returns>
        public virtual List<Control> GetConfigurationControls( bool canConfig, bool canEdit )
        {
            List<Control> configControls = new List<Control>();

            if ( canConfig || canEdit)
            {
                // Attributes
                CompiledTemplateBuilder upContent = new CompiledTemplateBuilder(
                    delegate( Control content )
                    {
                        Button trigger = new Button();
                        trigger.ClientIDMode = System.Web.UI.ClientIDMode.Static;
                        trigger.ID = string.Format( "blck-cnfg-trggr-{0}", BlockInstance.Id.ToString() );
                        trigger.Click += trigger_Click;
                        content.Controls.Add( trigger );

                        HiddenField triggerData = new HiddenField();
                        triggerData.ClientIDMode = System.Web.UI.ClientIDMode.Static;
                        triggerData.ID = string.Format( "blck-cnfg-trggr-data-{0}", BlockInstance.Id.ToString() );
                        content.Controls.Add( triggerData );
                    }
                );

                UpdatePanel upTrigger = new UpdatePanel();
                upTrigger.ContentTemplate = upContent;
                configControls.Add( upTrigger );
                upTrigger.Attributes.Add( "style", "display:none" );

                // Icon to display block properties
                HtmlGenericControl aAttributes = new HtmlGenericControl( "a" );
                aAttributes.Attributes.Add( "class", "properties icon-button show-modal-iframe" );
                aAttributes.Attributes.Add( "height", "500px" );
                aAttributes.Attributes.Add( "href", ResolveUrl( string.Format( "~/BlockProperties/{0}?t=Block Properties", BlockInstance.Id ) ) );
                //aAttributes.Attributes.Add( "instance-id", BlockInstance.Id.ToString() );
                configControls.Add( aAttributes );
            }

            if ( canConfig )
            {
                // Security
                HtmlGenericControl aSecureBlock = new HtmlGenericControl( "a" );
                aSecureBlock.Attributes.Add( "class", "security icon-button show-modal-iframe" );
                aSecureBlock.Attributes.Add( "height", "500px" );
                aSecureBlock.Attributes.Add( "href", ResolveUrl( string.Format( "~/Secure/{0}/{1}?t=Block Security",
                    Security.Authorization.EncodeEntityTypeName( BlockInstance.GetType() ), BlockInstance.Id ) ) );
                configControls.Add( aSecureBlock );

                // Move
                HtmlGenericControl aMoveBlock = new HtmlGenericControl( "a" );
                aMoveBlock.Attributes.Add( "class", "block-move icon-button blockinstance-move" );
                aMoveBlock.Attributes.Add("href", BlockInstance.Id.ToString());
                aMoveBlock.Attributes.Add( "zone", BlockInstance.Zone );
                aMoveBlock.Attributes.Add( "zoneloc", BlockInstance.BlockInstanceLocation.ToString() );
                aMoveBlock.Attributes.Add( "title", "Move" );
                configControls.Add( aMoveBlock );

                // Delete
                HtmlGenericControl aDeleteBlock = new HtmlGenericControl( "a" );
                aDeleteBlock.Attributes.Add( "class", "delete icon-button blockinstance-delete" );
                aDeleteBlock.Attributes.Add("href", BlockInstance.Id.ToString());
                aDeleteBlock.Attributes.Add( "title", "Delete" );
                configControls.Add( aDeleteBlock );
            }

            return configControls;
        }
Ejemplo n.º 34
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     this.updatePanel = new UpdatePanel();
     this.updatePanel.ID = "updatePanel";
     Table table = new Table();
     table.ApplyStyle(this._tableStyle);
     TableRow tableRow = new TableRow();
     TableCell tableCell = new TableCell();
     this.hiddenResultsCount = new HiddenField();
     this.hiddenResultsCount.ID = "hiddenResultsCount";
     tableCell.Controls.Add(this.hiddenResultsCount);
     this.hiddenCurrentPage = new HiddenField();
     this.hiddenCurrentPage.ID = "hiddenCurrentPage";
     tableCell.Controls.Add(this.hiddenCurrentPage);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.firstButton = new Button();
     this.firstButton.CssClass = "paginater_first";
     this.firstButton.Click += new EventHandler(this.firstButton_Click);
     tableCell.Controls.Add(this.firstButton);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.backwardButton = new Button();
     this.backwardButton.CssClass = "paginater_left";
     this.backwardButton.Click += new EventHandler(this.backwardButton_Click);
     tableCell.Controls.Add(this.backwardButton);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.currentLabel = new Label();
     this.currentLabel.ApplyStyle(this._labelStyle);
     this.currentLabel.Text = "0";
     tableCell.Controls.Add(this.currentLabel);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.ofLabel = new Label();
     this.ofLabel.ApplyStyle(this._labelStyle);
     this.ofLabel.Text = this._ofText;
     tableCell.Controls.Add(this.ofLabel);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.totalLabel = new Label();
     this.totalLabel.ApplyStyle(this._labelStyle);
     this.totalLabel.Text = "0";
     tableCell.Controls.Add(this.totalLabel);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.forwardButton = new Button();
     this.forwardButton.CssClass = "paginater_right";
     this.forwardButton.Click += new EventHandler(this.forwardButton_Click);
     tableCell.Controls.Add(this.forwardButton);
     tableRow.Controls.Add(tableCell);
     tableCell = new TableCell();
     this.lastButton = new Button();
     this.lastButton.CssClass = "paginater_last";
     this.lastButton.Click += new EventHandler(this.lastButton_Click);
     tableCell.Controls.Add(this.lastButton);
     tableRow.Controls.Add(tableCell);
     table.Rows.Add(tableRow);
     this.updatePanel.ContentTemplateContainer.Controls.Add(table);
     this.Controls.Add(this.updatePanel);
 }
Ejemplo n.º 35
0
 /// <summary>
 /// 控件点击 消息提示框
 /// </summary>
 /// <param name="page">当前页面指针,一般为this</param>
 /// <param name="msg">提示信息</param>
 public static void ShowUpdatePanel(System.Web.UI.UpdatePanel Control, string msg)
 {
     //Control.Attributes.Add("onClick","if (!window.confirm('"+msg+"')){return false;}");
     //Control.Attributes.Add("onclick", "return confirm('" + msg + "');");
     System.Web.UI.ScriptManager.RegisterStartupScript(Control, Control.GetType(), "unReport", "alert('" + msg + "');", true);
 }
Ejemplo n.º 36
0
        public static void MuestraMensajeAJAX(System.Web.UI.UpdatePanel up, string strMessage)
        {
            string strScript = "alert(' " + strMessage + " ');";

            System.Web.UI.ScriptManager.RegisterStartupScript(up, up.GetType(), "msgbox", strScript, true);
        }
Ejemplo n.º 37
0
    public static void CloseControl(this System.Web.UI.UpdatePanel udPnl, string dialogID)
    {
        string Script = @"CloseControl('{0}');"; // 注意,有經過String.Format的話大括號要重複

        System.Web.UI.ScriptManager.RegisterClientScriptBlock(udPnl, udPnl.GetType(), "Close", String.Format(Script, dialogID), true);
    }
Ejemplo n.º 38
0
 public static void RunScript(this System.Web.UI.UpdatePanel ctl, string script)
 {
     System.Web.UI.ScriptManager.RegisterClientScriptBlock(ctl, ctl.GetType(), "Scripts", script, true);
 }
        private void ProcessUpdatePanels()
        {
            Debug.Assert(_owner.IsInAsyncPostBack);
            Debug.Assert(_updatePanelsToRefresh == null);

            if (_allUpdatePanels != null)
            {
                _updatePanelsToRefresh      = new List <UpdatePanel>(_allUpdatePanels.Count);
                _childUpdatePanelsToRefresh = new List <UpdatePanel>(_allUpdatePanels.Count);

                // Process the UpdatePanels to determine which are to be set in
                // partial rendering mode.

                // We need to process the list such that parent UpdatePanels are
                // evaluated first. A child UpdatePanel inside a parent that is being
                // updated should not be considered in partial rendering mode.
                // Ordinarily child controls get initialized first before their parents
                // so you'd expect the list to be in reverse order, but this isn't the case.
                // UpdatePanels instantiate their templates in their OnInit, so a child
                // UpdatePanel only exists in the control tree after the parent has been
                // initialized.

                HtmlForm form = _owner.Page.Form;

                for (int i = 0; i < _allUpdatePanels.Count; i++)
                {
                    UpdatePanel panel = _allUpdatePanels[i];

                    // Check whether the panel thinks it wants to update. Possible reasons
                    // a panel might be updating:
                    // - Postback data indicates the postback came from within the panel
                    // - Postback data indicates the postbacks was caused by PageRequestManager.beginAsyncPost
                    //   and the update panel was explicitly requested to update
                    // - Explicit call to panel.Update()
                    // - Panel UpdateMode set to Always
                    // - Trigger fired (not yet implemented)

                    bool requiresUpdate = panel.RequiresUpdate ||
                                          (_updatePanelRequiresUpdate != null && String.Equals(panel.UniqueID, _updatePanelRequiresUpdate, StringComparison.Ordinal)) ||
                                          (_updatePanelsRequireUpdate != null && Array.IndexOf(_updatePanelsRequireUpdate, panel.UniqueID) != -1);

                    // Check and see if a parent panel will take update this panel, whether
                    // this panel wants to update or not. If so, then this panel doesn't need
                    // to be in update mode since it will get included in the rendering
                    // by its parent anyway.
                    // If this parent doesn't want to update then we don't need to do any
                    // additional checks because whether it renders depends entirely on
                    // whether the parent wants to render.
                    Control parent = panel.Parent;
                    while (parent != form)
                    {
                        UpdatePanel parentUpdatePanel = parent as UpdatePanel;
                        if ((parentUpdatePanel != null) &&
                            (_updatePanelsToRefresh.Contains(parentUpdatePanel) || _childUpdatePanelsToRefresh.Contains(parentUpdatePanel)))
                        {
                            // This panel is inside another UpdatePanel that is being
                            // rendered, so it should render in normal mode.
                            requiresUpdate = false;
                            _childUpdatePanelsToRefresh.Add(panel);
                            break;
                        }

                        parent = parent.Parent;

                        if (parent == null)
                        {
                            // This UpdatePanel was not inside an HtmlForm
                            // This really shouldn't happen, because the UpdatePanel would have thrown
                            // an exception on the initial GET request that it should be inside a form,
                            // so we'll just ignore it now...
                            requiresUpdate = false;
                            break;
                        }
                    }

                    if (requiresUpdate)
                    {
                        panel.SetAsyncPostBackMode(true);
                        _updatePanelsToRefresh.Add(panel);
                    }
                    else
                    {
                        panel.SetAsyncPostBackMode(false);
                    }
                }
            }
        }
Ejemplo n.º 40
0
    public static void ShowControl(this System.Web.UI.UpdatePanel udPnl, string dialogID, string titleName)
    {
        string Script = @"LoadControl('{0}', '{1}', '{2}');"; // 注意,有經過String.Format的話大括號要重複

        System.Web.UI.ScriptManager.RegisterClientScriptBlock(udPnl, udPnl.GetType(), "Show", String.Format(Script, dialogID, titleName, udPnl.Page.ResolveUrl("~/img/closebutton.ico")), true);
    }
Ejemplo n.º 41
0
    public void MostrarMensajeCheto(String titulo, String mensajeAyuda, Label labelAyuda, System.Web.UI.UpdatePanel contenedor)
    {
        string script = "$('#ventanaAyuda').modal('show');";

        labelAyuda.Text    = crearAyudaModal(titulo, mensajeAyuda, script);
        labelAyuda.Visible = true;
        System.Web.UI.ScriptManager.RegisterStartupScript(contenedor, contenedor.GetType(), Guid.NewGuid().ToString(), script, true);
    }
Ejemplo n.º 42
0
 /// <summary>
 /// 控件点击 消息确认提示框
 /// </summary>
 /// <param name="page">当前页面指针,一般为this</param>
 /// <param name="msg">提示信息</param>
 public static void ShowUpdatePanelConfirm(System.Web.UI.UpdatePanel Control, string msg)
 {
     System.Web.UI.ScriptManager.RegisterOnSubmitStatement(Control, Control.GetType(), "test", "return confirm('" + msg + "');");
     // ScriptManager.RegisterOnSubmitStatement(UpdatePanel1, this.GetType(),"test", "return window.confirm('test')");
 }
Ejemplo n.º 43
0
 /// <summary>
 /// Adds an update trigger for when the block instance properties are updated.
 /// </summary>
 /// <param name="updatePanel">The update panel.</param>
 public void AddAttributeUpdateTrigger( UpdatePanel updatePanel )
 {
     if ( BlockInstance.Authorized( "Configure", CurrentUser ) )
     {
         AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
         trigger.ControlID = string.Format( "blck-cnfg-trggr-{0}", BlockInstance.Id );
         trigger.EventName = "Click";
         updatePanel.Triggers.Add( trigger );
     }
 }
Ejemplo n.º 44
0
 public static void MostrarMSG(string Mensaje, System.Web.UI.UpdatePanel Panel)
 {
     System.Web.UI.ScriptManager.RegisterStartupScript(Panel, typeof(string), "script1", "alert('" + Mensaje + "');", true);
 }