private void Page_Load(object sender, System.EventArgs e) 
		{
			System.Web.UI.HtmlControls.HtmlForm frm = (HtmlForm)FindControl("Form1");
			GHTTestBegin(frm);
            
			//False
			GHTSubTestBegin("Causes validation = false"); 
			try
			{ 
				System.Web.UI.HtmlControls.HtmlButton btn = new System.Web.UI.HtmlControls.HtmlButton(); 
				btn.CausesValidation = false; 
				GHTActiveSubTest.Controls.Add(btn); 
			} 
			catch (Exception ex) 
			{ 
				GHTSubTestUnexpectedExceptionCaught(ex); 
			}
			GHTTestEnd();

			//true
			GHTSubTestBegin("Causes validation = true"); 
			try
			{ 
				System.Web.UI.HtmlControls.HtmlButton btn = new System.Web.UI.HtmlControls.HtmlButton(); 
				btn.CausesValidation = true; 
				GHTActiveSubTest.Controls.Add(btn); 
			} 
			catch (Exception ex) 
			{ 
				GHTSubTestUnexpectedExceptionCaught(ex); 
			} 
			GHTTestEnd();

		}
		public void InnerText () {
			HtmlButton c = new HtmlButton ();
			DataBoundLiteralControl db = new DataBoundLiteralControl (1, 0);
			db.SetStaticString (0, "FFF");
			c.Controls.Add (db);
			Assert.AreEqual ("FFF", c.InnerText);
		}
        protected override void OnLoad(EventArgs e)
        {
 	        base.OnLoad(e);
            base.CssClass = "btn-group";

            HtmlButton btn = new HtmlButton();
            btn.InnerText = Text;
            btn.Attributes.Add("class", "btn");
            this.Controls.Add(btn);

            HtmlButton btnToggle = new HtmlButton();
            btnToggle.InnerHtml = "<span class='caret'></span>";
            btnToggle.Attributes.Add("class", "btn dropdown-toggl");
            btnToggle.Attributes.Add("data-toggle", "dropdown");
            this.Controls.Add(btnToggle);

            Literal list = new Literal();
            this.Controls.Add(list);

            StringBuilder sb = new StringBuilder();
            sb.Append("<ul class='dropdown-menu'>");

            foreach (var htmlAnchor in HtmlAnchors)
            {
                sb.Append("<li><a ");
                foreach (var attr in htmlAnchor.Attributes.Keys)
                {
                    sb.Append(attr + "='" + htmlAnchor.Attributes[attr.ToString()] + "' ");
                }
                sb.Append(">" + htmlAnchor.InnerText + "</a></li>");
            }

            sb.Append("</ul>");
            list.Text = sb.ToString();
        }
Exemple #4
0
        protected void OnServerClick(object sender, EventArgs e)
        {
            System.Web.UI.HtmlControls.HtmlButton button = (System.Web.UI.HtmlControls.HtmlButton)sender;
            var buttonId = button.ID.Remove(0, 6);

            if (hfActiveButtonId.Value == "")
            {
                hfActiveButtonId.Value = button.ID;
            }
            else
            {
                //Response.Write($@"<script>alert('{hfActiveButtonId.Value}');</script>");
                var oldActiveButton = btnGroup.FindControl(hfActiveButtonId.Value) as System.Web.UI.HtmlControls.HtmlButton;
                if (oldActiveButton != null)
                {
                    oldActiveButton.Attributes.Remove("class");
                    oldActiveButton.Attributes.Add("class", "btn btn-default");
                }
                hfActiveButtonId.Value = button.ID;
            }

            //Response.Write($@"<script>alert('{buttonId}');</script>");
            hfFilterButton.Value = buttonId != "All" ? buttonId : "";
            button.Attributes.Add("class", "btn btn-default active");
            tbSearch.Text = "";
            ClearFilters();
            RadGrid1.Rebind();
        }
Exemple #5
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            System.Web.UI.HtmlControls.HtmlForm frm = (HtmlForm)FindControl("Form1");
            GHTTestBegin(frm);

            //False
            GHTSubTestBegin("Causes validation = false");
            try
            {
                System.Web.UI.HtmlControls.HtmlButton btn = new System.Web.UI.HtmlControls.HtmlButton();
                btn.CausesValidation = false;
                GHTActiveSubTest.Controls.Add(btn);
            }
            catch (Exception ex)
            {
                GHTSubTestUnexpectedExceptionCaught(ex);
            }
            GHTTestEnd();

            //true
            GHTSubTestBegin("Causes validation = true");
            try
            {
                System.Web.UI.HtmlControls.HtmlButton btn = new System.Web.UI.HtmlControls.HtmlButton();
                btn.CausesValidation = true;
                GHTActiveSubTest.Controls.Add(btn);
            }
            catch (Exception ex)
            {
                GHTSubTestUnexpectedExceptionCaught(ex);
            }
            GHTTestEnd();
        }
		public void InnerText2 () {
			HtmlButton c = new HtmlButton ();
			DesignerDataBoundLiteralControl x = new DesignerDataBoundLiteralControl ();
			x.Text = "FFF";
			c.Controls.Add (x);
			string s = c.InnerText;
		}
        public UrlSelector()
			: base("div")
        {
			Input = new TextBox();
			Buttons = new HtmlGenericControl("span");
			ClearButton = new HtmlButton();
			PopupButton = new HtmlButton();
		}
Exemple #8
0
    protected void CloseCommBtn(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            System.Web.UI.HtmlControls.HtmlButton btn = (System.Web.UI.HtmlControls.HtmlButton)sender;
            string t         = btn.InnerHtml;
            int    v_comm_id = Int32.Parse(Regex.Match(t, @"\d+").Value);
            try
            {
                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\StefaniaPirvu\Desktop\YrmeApp\App_Data\Database.mdf;Integrated Security=True");
                using (con)
                {
                    // check if the user who deletes is  admin
                    con.Open();
                    string     get_role      = "SELECT role_id FROM dbo.User_Roles WHERE USER_ID = @userid";
                    SqlCommand get_role_comm = new SqlCommand(get_role, con);
                    get_role_comm.Parameters.AddWithValue("@userid", g_user_id);
                    int role = Convert.ToInt32(get_role_comm.ExecuteScalar());
                    con.Close();

                    // check if the user who deletes is  admin
                    con.Open();
                    string     get_comm_owner = "SELECT user_id FROM Comments WHERE comment_id = @commid";
                    SqlCommand get_comm_com   = new SqlCommand(get_comm_owner, con);
                    get_comm_com.Parameters.AddWithValue("@commid", v_comm_id);
                    int v_comm_owner_id = Convert.ToInt32(get_comm_com.ExecuteScalar());
                    con.Close();

                    if (role != 3)
                    {
                        if (g_user_id != v_comm_owner_id)
                        {
                            CommErrors.Text = "You do not have the rights to delete this photo!";
                            return;
                        }
                    }

                    //if not owner or admin

                    con.Open();
                    string     delete_comm_query = "delete from Comments where comment_id = @commid";
                    SqlCommand delete_comm_com   = new SqlCommand(delete_comm_query, con);
                    delete_comm_com.Parameters.AddWithValue("@commid", v_comm_id);
                    delete_comm_com.ExecuteNonQuery();
                    con.Close();
                }

                HttpContext.Current.Response.RedirectToRoute("Photo", new { id = g_photo_id });
            }
            catch (SqlException ex)
            {
                CommErrors.Text = ex.Message;
            }

            return;
        }
    }
Exemple #9
0
        public MediaSelector()
			: base("div")
        {
            PopupOptions = "height=580,width=960,resizable=yes,status=no,scrollbars=yes";

			Input = new TextBox();
			Buttons = new HtmlGenericControl("span");
			ClearButton = new HtmlButton();
			PopupButton = new HtmlButton();
		}
Exemple #10
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     SE se= new SE();
     se.EvalSearchString(TextBox1.Text,TermGroup.any);
     docs =se.GetResult();
     GridView1.DataSource = docs.Select(doc =>{
         HtmlButton link = new HtmlButton();
         link.ID = doc.id.ToString();
         return new { doc.name, doc.weight, link,doc.path };
     });
     GridView1.DataBind();
 }
Exemple #11
0
 private void AddPrintButton(HtmlGenericControl container)
 {
     if (this.DisplayPrintButton)
     {
         using (HtmlButton button = new HtmlButton())
         {
             button.Attributes.Add("type", "button");
             button.Attributes.Add("id", "PrintButton");
             button.Attributes.Add("class", "ui teal button");
             button.InnerText = Titles.Print;
             container.Controls.Add(button);
         }
     }
 }
Exemple #12
0
        public static void EnableDisableCtrlEnum(bool enabled, IEnumerable ctrls)
        {
            System.Web.UI.WebControls.TextBox     txt = null;
            System.Web.UI.HtmlControls.HtmlSelect cmb = null;
            System.Web.UI.HtmlControls.HtmlButton btn = null;

            if (!enabled) //Disable
            {
                foreach (var ctrl in ctrls)
                {
                    if (ctrl is System.Web.UI.WebControls.TextBox)
                    {
                        txt = (System.Web.UI.WebControls.TextBox)ctrl;
                        //AddAttributeWeb("readonly", "true", txt);
                        txt.ReadOnly = true;
                    }
                    else if (ctrl is System.Web.UI.HtmlControls.HtmlSelect)
                    {
                        cmb = (System.Web.UI.HtmlControls.HtmlSelect)ctrl;
                        //AddAttribute("disabled", "true", cmb);
                        cmb.Disabled = true;
                    }
                    else if (ctrl is System.Web.UI.HtmlControls.HtmlButton)
                    {
                        btn = (System.Web.UI.HtmlControls.HtmlButton)ctrl;
                        //AddAttribute("disabled", "true", cmb);
                        btn.Disabled = true;
                    }
                }
            }
            else //Enable
            {
                foreach (var ctrl in ctrls)
                {
                    if (ctrl is System.Web.UI.WebControls.TextBox)
                    {
                        txt          = (System.Web.UI.WebControls.TextBox)ctrl;
                        txt.ReadOnly = false;
                        txt.Enabled  = true;
                    }
                    else if (ctrl is System.Web.UI.HtmlControls.HtmlSelect)
                    {
                        cmb = (System.Web.UI.HtmlControls.HtmlSelect)ctrl;
                        RemoveAttribute("disabled", cmb);
                        cmb.Disabled = false;
                    }
                }
            }
        }
Exemple #13
0
        private void AddFlagButton(HtmlGenericControl container)
        {
            if (this.DisplayFlagButton)
            {
                using (HtmlButton button = new HtmlButton())
                {
                    button.Attributes.Add("type", "button");
                    button.Attributes.Add("id", "FlagButton");
                    button.Attributes.Add("class", "ui orange button");
                    button.InnerText = Titles.Flag;

                    container.Controls.Add(button);
                }
            }
        }
Exemple #14
0
        private void AddApproveButton(HtmlGenericControl container)
        {
            if (this.DisplayApproveButton)
            {
                using (HtmlButton button = new HtmlButton())
                {
                    button.Attributes.Add("type", "button");
                    button.Attributes.Add("id", "ApproveButton");
                    button.Attributes.Add("title", "CTRL + K");
                    button.Attributes.Add("class", "ui positive button");
                    button.InnerText = Titles.Approve;

                    container.Controls.Add(button);
                }
            }
        }
Exemple #15
0
        private void AddAddButton(HtmlGenericControl container)
        {
            if (this.DisplayAddButton)
            {
                using (HtmlButton button = new HtmlButton())
                {
                    button.Attributes.Add("type", "button");
                    button.Attributes.Add("id", "AddNewButton");
                    button.Attributes.Add("class", "ui blue button");
                    button.Attributes.Add("onclick", string.Format(CultureInfo.InvariantCulture, "window.location='{0}'", this.AddNewPath));
                    button.InnerText = Titles.AddNew;

                    container.Controls.Add(button);
                }
            }
        }
Exemple #16
0
 protected void Button1_Click1(object sender, EventArgs e)
 {
     SE se = new SE();
     se.EvalSearchString(TextBox1.Text, TermGroup.institute);
     se.EvalSearchString(TextBox2.Text, TermGroup.napr);
     se.EvalSearchString(TextBox3.Text, TermGroup.kvalif);
     se.EvalSearchString(TextBox4.Text, TermGroup.fobuch);
     se.EvalSearchString(TextBox5.Text, TermGroup.disciplin);
     se.EvalSearchString(TextBox6.Text, TermGroup.sostavitel);
     se.EvalSearchString(TextBox7.Text, TermGroup.zaveril);
     se.EvalSearchString(TextBox8.Text, TermGroup.body);
     docs = se.GetResult();
     GridView1.DataSource = docs.Select(doc =>
     {
         HtmlButton link = new HtmlButton();
         link.ID = doc.id.ToString();
         return new { doc.name, doc.weight, link, doc.path };
     });
     GridView1.DataBind();
 }
Exemple #17
0
        public static HtmlButton GetButton(string id, string cssClass, [Localizable(true)] string text)
        {
            using (HtmlButton button = new HtmlButton())
            {
                button.Attributes.Add("type", "button");

                if (!string.IsNullOrWhiteSpace(id))
                {
                    button.ID = id;
                }

                if (!string.IsNullOrWhiteSpace(cssClass))
                {
                    button.Attributes.Add("class", cssClass);
                }

                button.InnerText = text;

                return button;
            }
        }
        private void CreateStartButton(HtmlGenericControl container)
        {
            using (HtmlButton startButton = new HtmlButton())
            {
                startButton.ID = "StartButton";
                startButton.Attributes.Add("class", "ui blue loading disabled button");
                startButton.Attributes.Add("onclick", "return false;");
                startButton.InnerText = Titles.Start;

                container.Controls.Add(startButton);
            }
        }
Exemple #19
0
        private HtmlButton GetInputButton(string title, string onclick, string value, string cssClass)
        {
            using (var inputButton = new HtmlButton())
            {
                inputButton.Attributes.Add("class", this.ButtonCssClass);
                inputButton.Attributes.Add("type", "button");
                inputButton.Attributes.Add("title", title);
                inputButton.Attributes.Add("onclick", onclick);
                inputButton.InnerHtml = @"<span class='" + cssClass + "'></span> " + value;

                return inputButton;
            }
        }
Exemple #20
0
        private HtmlButton GetInputButton(string title, string onclick, string value, string cssClass, string iconCssClass)
        {
            using (HtmlButton inputButton = new HtmlButton())
            {
                inputButton.Attributes.Add("class", cssClass);
                inputButton.Attributes.Add("type", "button");
                inputButton.Attributes.Add("title", title);
                inputButton.Attributes.Add("onclick", onclick);

                if (!string.IsNullOrWhiteSpace(iconCssClass))
                {
                    inputButton.InnerHtml = @"<i class='" + iconCssClass + "'></i> " + value;
                }
                else
                {
                    inputButton.InnerHtml = value;
                }

                return inputButton;
            }
        }
Exemple #21
0
		/// <summary>
		/// Creates all chile controls
		/// </summary>
		protected override void CreateChildControls() 
		{
			
			#region Add our ulb controls
			licenseComment = new LiteralControl("");
			Controls.Add(licenseComment);
			
			ulbHolder = new HtmlGenericControl("nobr");
			ulbHolder.ID="ulbHolder";

			#region ulbTextBox
			ulbTextBox = new TextBox();
			ulbTextBox.ID="ulbTextBox";
			ulbTextBox.Attributes.Add("autocomplete","off");
			ulbTextBox.Columns=textBoxColumnsDefault;
			//ulbTextBox.Attributes.Add("size",textBoxColumnsDefault.ToString());
			ulbTextBox.Attributes.Add("style",textBoxStyleDefault);
			ulbTextBox.Text="";
			ulbHolder.Controls.Add(ulbTextBox);
			#endregion

			#region ulbButtonHolder inc ulbSearchButton, ulbHelpButton
			ulbButtonHolder = new Label();
			//if (!DesignMode)
			//{
			//	if (HttpContext.Current.Request.UserAgent.IndexOf("Windows NT 5.1")>-1)
			//		ulbButtonHolder.Attributes.Add("style","position:relative;left:-2;top:1;z-index:500;");
			//	else
			//		ulbButtonHolder.Attributes.Add("style","position:relative;left:-2;z-index:500;");
			//}

			#region ulbSearchButton
			ulbSearchButton = new HtmlButton();
			ulbSearchButton.InnerHtml="<img src=\""+serverDirDefault+"DbComboServer.aspx?DownArrow\" style=\"vertical-align:middle;\" />";
			ulbSearchButton.Attributes.Add("style",upLevelButtonStyleDefault);
			ulbSearchButton.Visible=showUpLevelSearchButtonDefault;
			ulbSearchButton.ID="ulbSearchButton";
			ulbSearchButton.Attributes.Add("tabindex","-1");
			ulbButtonHolder.Controls.Add(ulbSearchButton);
			#endregion

			#region ulbClearButton (removed)
			//	ulbClearButton = new HtmlInputButton();
			//	ulbClearButton.Value=textClearButtonDefault;
			//	ulbClearButton.Attributes.Add("style",upLevelButtonStyleDefault);
			//	ulbClearButton.Visible=false;
			//	ulbClearButton.ID="ulbClearButton";
			//	ulbButtonHolder.Controls.Add(ulbClearButton);
			#endregion
			
			#region ulbHelpButton
			ulbHelpButton = new HtmlGenericControl("input");
			ulbHelpButton.Attributes.Add("type", "button");
			ulbHelpButton.Attributes.Add("value", textHelpButtonDefault);
			ulbHelpButton.Attributes.Add("style", upLevelButtonStyleDefault);
			ulbHelpButton.Attributes.Add("onclick", "alert('"+textUpLevelHelpBox+"');return false;");
			ulbHelpButton.Visible=showUpLevelHelpButtonDefault;
			ulbHelpButton.ID="ulbHelpButton";
			ulbButtonHolder.Controls.Add(ulbHelpButton);
			#endregion
			
			#region ulbRevertButton (removed)
			//	ulbRevertButton = new HtmlGenericControl("input");
			//	ulbRevertButton.Attributes.Add("type",  "button");
			//	ulbRevertButton.Attributes.Add("style", upLevelButtonStyleDefault);
			//	ulbRevertButton.Attributes.Add("value", textRevertButtonDefault);
			//	ulbRevertButton.ID="ulbRevertButton";
			//	ulbRevertButton.Visible=showRevertButtonDefault;
			//	ulbButtonHolder.Controls.Add(ulbRevertButton);
			#endregion

			ulbHolder.Controls.Add(ulbButtonHolder);
			#endregion

			#region ulbQueryHidden
			ulbQueryHidden = new HtmlInputHidden();
			ulbQueryHidden.ID="ulbQueryHidden";
			ulbQueryHidden.Value="";
			ulbHolder.Controls.Add(ulbQueryHidden);
			#endregion

			#region ulbReQueryOnLoad
			ulbReQueryOnLoad = new HtmlInputHidden();
			ulbReQueryOnLoad.ID="ulbReQueryOnLoad";
			ulbReQueryOnLoad.Value=reQueryOnLoadDefault.ToString().ToLower();
			ulbHolder.Controls.Add(ulbReQueryOnLoad);
			#endregion

			#region ulbReQueryRecordsHidden
			ulbReQueryRecordsHidden = new HtmlInputHidden();
			ulbReQueryRecordsHidden.ID="ulbReQueryRecordsHidden";
			ulbReQueryRecordsHidden.Value=reQueryRecordsDefault.ToString();
			ulbHolder.Controls.Add(ulbReQueryRecordsHidden);
			#endregion

			#region ulbValueHidden
			ulbValueHidden = new HtmlInputHidden();
			ulbValueHidden.ID="ulbValueHidden";
			ulbValueHidden.Value="";
			ulbHolder.Controls.Add(ulbValueHidden);
			#endregion

			if (DesignMode)
				ulbHolder.Controls.Add(new LiteralControl("<br>"));

			#region ulbResultsSpan - inc. ulbDropDown, ulbMoreResultsButton and ulbStatusDisplaySpan
			ulbResultsSpan = new HtmlGenericControl("div");
			ulbResultsSpan.ID="ulbResultsSpan";
			ulbResultsSpan.Attributes.Add("style",resultsBackgroundSpanStyleDefault);

			ulbInnerResultsSpan = new HtmlGenericControl("span");
			ulbInnerResultsSpan.Attributes.Add("style",resultsInnerSpanStyleDefault);

			#region ulbDropDown
			ulbDropDown = new DropDownList();
			ulbDropDown.ID="ulbDropDown";
			ulbDropDown.Attributes.Add("size",dropDownRowsDefault.ToString());
			//ulbDropDown.Attributes.Add("multiple","true");
			ulbDropDown.Attributes.Add("tabindex","-1");
			if (DesignMode)
			{
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 1","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 2","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 3","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 4","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 5","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 6","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 7","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 8","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 9","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 10","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 11","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 12","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 13","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 14","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 15","1"));
				ulbDropDown.Items.Add(new ListItem("Drop-down test item 16","1"));
			}
			ulbSpacer = new Label();
			ulbSpacer.ID="ulbSpacer";
			ulbClipper = new Label();
			ulbClipper.ID="ulbClipper";
			if (DesignMode)
				ulbClipper.Attributes.Add("style","");
			else
				ulbClipper.Attributes.Add("style","overflow:hidden;position:absolute;clip:rect(5px 50px 50px 5px);top:-3;left:-3;");
			ulbClipper.Controls.Add(ulbDropDown);
			ulbSpacer.Controls.Add(ulbClipper);
			ulbInnerResultsSpan.Controls.Add(ulbSpacer);
			ulbResultsSpan.Controls.Add(ulbInnerResultsSpan);
			#endregion

			#region ulbStatusDisplaySpan
			ulbStatusDisplaySpan = new HtmlGenericControl("div");
			ulbStatusDisplaySpan.ID="ulbStatusDisplaySpan";
			ulbStatusDisplaySpan.Attributes.Add("style",statusMessageStyleDefault);
			if (DesignMode)
			{
				ulbStatusDisplaySpan.InnerText="Status Message";
			}
			ulbResultsSpan.Controls.Add(ulbStatusDisplaySpan);
			#endregion

			ulbStatusBarDiv = new HtmlGenericControl("div");
			ulbStatusBarDiv.Attributes.Add("style",moreResultsBarStyleDefault);
			ulbStatusBarDiv.ID="ulbStatusBar";

			ulbStatusBarDiv.Controls.Add(new LiteralControl("<nobr>"));

			#region ulbMoreResultsButton
			ulbMoreResultsButton = new HtmlInputButton();
			ulbMoreResultsButton.ID="ulbMoreResultsButton";
			ulbMoreResultsButton.Attributes.Add("style",upLevelMoreResultsButtonStyleDefault);
			ulbMoreResultsButton.Value=textMoreButtonDefault;
			ulbMoreResultsButton.Attributes.Add("tabindex","-1");
			ulbStatusBarDiv.Controls.Add(ulbMoreResultsButton);
			#endregion
            
			#region ulbLogoPlaceHolder
			ulbLogoPlaceHolder = new PlaceHolder();
			ulbLogoPlaceHolder.Visible = showDbComboLinkDefault;
			ulbServerDirLogo = new LiteralControl(serverDirDefault);
			ulbLogoImgAndLink = new LiteralControl(@"<a href=""http://www.dbcombo.net/home.aspx?campaignk=8&affpurchasek=0"" target=""_blank"" tabindex=""-1""><img src=""");
			ulbLogoPlaceHolder.Controls.Add(ulbLogoImgAndLink);
			ulbLogoPlaceHolder.Controls.Add(ulbServerDirLogo);
			ulbLogoPlaceHolder.Controls.Add(new LiteralControl("DbComboServer.aspx?f\" hspace=\"2\" vspace=\"2\" border=\"0\" style=\"vertical-align:bottom;\" alt=\"This is DbCombo.net. The items you see in the drop-down are delivered from the server in real-time. Click to find out more.\" /></a>"));
			//DbComboServer.aspx?f" vspace="2" hspace="2" border="0" style="vertical-align:bottom;" alt="This is DbCombo.net. The items you see in the drop-down are delivered from the server in real-time. Click to find out more."></a>
			ulbStatusBarDiv.Controls.Add(ulbLogoPlaceHolder);
			#endregion

			ulbStatusBarDiv.Controls.Add(new LiteralControl("</nobr>"));

			ulbResultsSpan.Controls.Add(ulbStatusBarDiv);

			ulbNewVersionDiv = new HtmlGenericControl("div");
			ulbNewVersionDiv.Attributes["style"]="background-color:red;color:white;font-weight:bold;padding:3px;font-family:Arial, Verdana, Sans-serif;font-size:x-small;";
			ulbNewVersionDiv.Visible=false;
			ulbResultsSpan.Controls.Add(ulbNewVersionDiv);

			ulbTestMode1 = new LiteralControl("");
			ulbResultsSpan.Controls.Add(ulbTestMode1);
			
			ulbHolder.Controls.Add(ulbResultsSpan);

			//string testMode4 = @"<div style=""""><img src=""http://north.cambro.net/allasp/sites/dbcombo/t3_0.aspx?a=1"" width=""1"" height=""1"" /></div>";
			ulbTestMode4 = new LiteralControl("");
			ulbHolder.Controls.Add(ulbTestMode4);

			if (DesignMode)
				if (DisplayResultsInDesigner)
					ulbResultsSpan.Visible=true;
				else
					ulbResultsSpan.Visible=false;

			#endregion

			#region initialise our LiteralControls
			ulbUniqueId					= new LiteralControl("");
			ulbDebug					= new LiteralControl(debugDefault.ToString().ToLower());
			ulbSetLanguage				= new LiteralControl("false");
			ulbSelectSingleItemOnEnter	= new LiteralControl(selectSingleItemOnEnterDefault.ToString().ToLower());
			ulbSelectSingleItemOnTab	= new LiteralControl(selectSingleItemOnTabDefault.ToString().ToLower());
			ulbTabToNextFieldOnEnter	= new LiteralControl(tabToNextFieldOnEnterDefault.ToString().ToLower());
			ulbAutoPostBack				= new LiteralControl(autoPostBackDefault.ToString().ToLower());
			//ulbAutoQueryOnLoad			= new LiteralControl(autoQueryOnLoadDefault.ToString().ToLower());
			//ulbReQueryOnLoad			= new LiteralControl(reQueryOnLoadDefault.ToString().ToLower());
			ulbReQueryDisabled			= new LiteralControl(reQueryDisabledDefault.ToString().ToLower());
			ulbShowDbComboLink			= new LiteralControl(showDbComboLinkDefault.ToString().ToLower());
			ulbServerAssembly			= new LiteralControl(serverAssemblyDefault);
			ulbServerType				= new LiteralControl(serverTypeDefault);
			ulbServerMethod				= new LiteralControl(serverMethodDefault);
			ulbDataMember				= new LiteralControl(dataMemberDefault);
			ulbDropDownRows				= new LiteralControl(dropDownRowsDefault.ToString());
			ulbServerDir				= new LiteralControl(serverDirDefault);
			ulbErrorBoxType				= new LiteralControl(errorBoxTypeDefault.ToString());
			ulbErrorBoxCustomText		= new LiteralControl(errorBoxCustomTextDefault.ToString());

			ulbParentAssembly			= new LiteralControl("");
			ulbParentType				= new LiteralControl("");
			ulbParentBaseAssembly		= new LiteralControl("");
			ulbParentBaseType			= new LiteralControl("");

			ulbDataValueField			= new LiteralControl(dataValueFieldDefault);
			ulbDataTextField			= new LiteralControl(dataTextFieldDefault);

			ulbPageAssembly				= new LiteralControl("");
			ulbPageType					= new LiteralControl("");
			ulbPageBaseAssembly			= new LiteralControl("");
			ulbPageBaseType				= new LiteralControl("");

			ulbHideIntersectingSelectTags = new LiteralControl(hideIntersectingSelectTagsDefault.ToString().ToLower());
			ulbHideAllSelectTags		= new LiteralControl(hideAllSelectTagsDefault.ToString().ToLower());

			ulbResultsSpanTweakX		= new LiteralControl(resultsSpanTweakXDefault.ToString());
			ulbResultsSpanTweakY		= new LiteralControl(resultsSpanTweakYDefault.ToString());

			ulbTextLoading				= new LiteralControl(textLoadingDefault);
			ulbTextNoResults			= new LiteralControl(textNoResultsDefault);
			ulbLatency					= new LiteralControl(latencyDefault.ToString());
			ulbClientStateFunction		= new LiteralControl(clientStateFunctionDefault);
			ulbClientOnSelectFunction	= new LiteralControl(clientOnSelectFunctionDefault);

			ulbServerState				= new LiteralControl("");
			ulbServerStateHash			= new LiteralControl("");

			ulbCloseResultsOnBlur		= new LiteralControl(closeResultsOnBlurDefault.ToString().ToLower());
			ulbCloseResultsOnClick		= new LiteralControl(closeResultsOnClickDefault.ToString().ToLower());
			ulbCloseResultsOnEnter		= new LiteralControl(closeResultsOnEnterDefault.ToString().ToLower());
			ulbCloseResultsOnTab		= new LiteralControl(closeResultsOnTabDefault.ToString().ToLower());

			ulbInvertArrow				= new LiteralControl(invertArrowDefault.ToString().ToLower());

			ulbClearQueryOnUpLevelSearchButton
				= new LiteralControl(clearQueryOnUpLevelSearchButtonDefault.ToString().ToLower());

			ulbJavaScriptInit			= new LiteralControl("");

			#endregion

			#region LiteralControls
			ulbHolder.Controls.Add(new LiteralControl(@"<script language=""javascript"">"));
			ulbHolder.Controls.Add(new LiteralControl(@"if (typeof(DbComboServerExists)!='undefined'){var this_c="""));
			ulbHolder.Controls.Add(ulbUniqueId);
			ulbHolder.Controls.Add(new LiteralControl(@""";eval(DbComboStringToEval(this_c,"));
			ulbHolder.Controls.Add(ulbDebug);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbSetLanguage);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbSelectSingleItemOnEnter);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbSelectSingleItemOnTab);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbTabToNextFieldOnEnter);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbAutoPostBack);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbReQueryDisabled);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			//ulbHolder.Controls.Add(ulbAutoQueryOnLoad);
			//ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbClearQueryOnUpLevelSearchButton);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbCloseResultsOnBlur);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbCloseResultsOnClick);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbCloseResultsOnEnter);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbCloseResultsOnTab);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbInvertArrow);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbHideIntersectingSelectTags);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbHideAllSelectTags);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbShowDbComboLink);
			ulbHolder.Controls.Add(new LiteralControl(@","""));
			ulbHolder.Controls.Add(ulbServerAssembly);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbServerType);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbServerMethod);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbDataMember);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbDataValueField);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbDataTextField);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbErrorBoxType);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbErrorBoxCustomText);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));

			ulbHolder.Controls.Add(ulbParentAssembly);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbParentType);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbParentBaseAssembly);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbParentBaseType);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));

			ulbHolder.Controls.Add(ulbPageAssembly);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbPageType);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbPageBaseAssembly);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbPageBaseType);
			ulbHolder.Controls.Add(new LiteralControl(@""","));

			ulbHolder.Controls.Add(ulbResultsSpanTweakX);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbResultsSpanTweakY);
			ulbHolder.Controls.Add(new LiteralControl(@","""));

			ulbHolder.Controls.Add(ulbTextLoading);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbTextNoResults);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbClientStateFunction);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbClientOnSelectFunction);
			ulbHolder.Controls.Add(new LiteralControl(@""","));
			ulbHolder.Controls.Add(ulbDropDownRows);
			ulbHolder.Controls.Add(new LiteralControl(@","));
			ulbHolder.Controls.Add(ulbLatency);
			ulbHolder.Controls.Add(new LiteralControl(@","""));
			ulbHolder.Controls.Add(ulbServerDir);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbServerState);
			ulbHolder.Controls.Add(new LiteralControl(@""","""));
			ulbHolder.Controls.Add(ulbServerStateHash);
			ulbHolder.Controls.Add(new LiteralControl(@"""));"));
			ulbHolder.Controls.Add(ulbJavaScriptInit);
			ulbHolder.Controls.Add(new LiteralControl(@"</script>"));
			#endregion

			Controls.Add(ulbHolder);
			#endregion

			#region Add our dlb controls
			dlbHolder = new Label();
			dlbHolder.Visible=false;

			#region dlbTextBox
			dlbTextBox = new TextBox();
			dlbTextBox.Text="";
			dlbTextBox.ID="dlbTextBox";
			dlbTextBox.Attributes.Add("size",textBoxColumnsDefault.ToString());
			dlbTextBox.Attributes.Add("autocomplete","off");
			dlbHolder.Controls.Add(dlbTextBox);
			dlbHolder.Controls.Add(new LiteralControl("&nbsp;"));
			#endregion

			#region dlbSearchButton
			dlbSearchButton = new HtmlInputButton();
			dlbSearchButton.ServerClick+=new EventHandler(dlbSearchButtonClick);
			dlbSearchButton.Value=textDownLevelSearchButtonDefault;
			dlbSearchButton.CausesValidation=false;
			dlbSearchButton.ID="dlbSearchButton";
			dlbSearchButton.Attributes["style"]=downLevelButtonStyleDefault;
			dlbHolder.Controls.Add(dlbSearchButton);
			dlbHolder.Controls.Add(new LiteralControl("&nbsp;"));
			#endregion

			#region dlbClearButton
			dlbClearButton = new HtmlInputButton();
			dlbClearButton.Value=textClearButtonDefault;
			dlbClearButton.ID= "dlbClearButton";
			dlbClearButton.CausesValidation=false;
			dlbClearButton.ServerClick+=new EventHandler(ClearValue);
			dlbHolder.Controls.Add(dlbClearButton);
			#endregion

			#region dlbHelpButton and dlbHelpButtonSpacer
			dlbHelpButtonSpacer = new LiteralControl("&nbsp;");
			dlbHolder.Controls.Add(dlbHelpButtonSpacer);
			dlbHelpButton = new HtmlGenericControl("input");
			dlbHelpButton.Attributes.Add("type", "button");
			dlbHelpButton.Visible = showDownLevelHelpButtonDefault;
			dlbHelpButton.Attributes.Add("value", textHelpButtonDefault);
			dlbHelpButton.Attributes.Add("onclick","alert('"+textDownLevelHelpBox+"');return false;");
			dlbHolder.Controls.Add(dlbHelpButton);
			#endregion
			
			#region dlbNoResultsLabel
			dlbHolder.Controls.Add(new LiteralControl("&nbsp;"));
			dlbNoResultsLabel = new Label();
			dlbNoResultsLabel.Text=textNoResultsDefault;
			dlbNoResultsLabel.ID="dlbNoResultsLabel";
			dlbNoResultsLabel.Visible=false;
			dlbHolder.Controls.Add(dlbNoResultsLabel);
			dlbHolder.Controls.Add(new LiteralControl("<br>"));
			#endregion

			#region dlbResultsHolder - inc. dlbListBox, dlbSelectButton, dlbMoreResultsButton
			dlbResultsHolder = new Label();

			#region dlbListBox
			dlbListBox = new ListBox();
			dlbListBox.ID="dlbListBox";
			dlbListBox.Rows=dropDownRowsDefault;
			dlbResultsHolder.Visible=false;
			dlbResultsHolder.Controls.Add(dlbListBox);
			dlbResultsHolder.Controls.Add(new LiteralControl("<br>"));
			#endregion

			#region dlbSelectButton
			dlbSelectButton = new HtmlInputButton();
			dlbSelectButton.ID="dlbSelectButton";
			dlbSelectButton.ServerClick+=new EventHandler(dlbSelectButtonClick);
			dlbSelectButton.Value=textSelectButtonDefault;
			dlbSelectButton.CausesValidation=false;
			dlbSelectButton.Visible=false;
			dlbResultsHolder.Controls.Add(dlbSelectButton);
			dlbResultsHolder.Controls.Add(new LiteralControl("&nbsp;"));
			#endregion

			#region dlbMoreResultsButton
			dlbMoreResultsButton = new HtmlInputButton();
			dlbMoreResultsButton.ID="dlbMoreResultsButton";
			dlbMoreResultsButton.ServerClick+=new EventHandler(dlbMoreResultsButtonClick);
			dlbMoreResultsButton.Value=textMoreButtonDefault;
			dlbMoreResultsButton.CausesValidation=false;
			dlbMoreResultsButton.Visible=false;
			dlbResultsHolder.Controls.Add(dlbMoreResultsButton);
			#endregion

			dlbHolder.Controls.Add(dlbResultsHolder);
			#endregion

			#region dlbValueHidden
			dlbValueHidden = new HtmlInputHidden();
			dlbValueHidden.ID="dlbValueHidden";
			dlbHolder.Controls.Add(dlbValueHidden);
			#endregion

			#region dlbRowsHidden
			dlbRowsHidden = new HtmlInputHidden();
			dlbRowsHidden.ID="dlbRowsHidden";
			dlbHolder.Controls.Add(dlbRowsHidden);
			#endregion
			
			Controls.Add(dlbHolder);
			#endregion

		}
        /// <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()
        {
            var subTabsPanel = new Panel();
            var tabs = uQuery.GetDocument(uQuery.GetIdFromQueryString())
                         .ContentType
                         .PropertyTypeGroups
                         .Where(x => this.options.TabIds.Contains(x.Id))
                         .OrderBy(x => x.SortOrder);

            if (tabs.Any())
            {
                switch (this.options.SubTabType)
                {
                    case SubTabType.Buttons:

                        int counter = 0;

                        HtmlButton subTabButton;
                        foreach (var tab in tabs)
                        {
                            subTabButton = new HtmlButton { InnerText = tab.Name };
                            subTabButton.Attributes.Add("data-tab", tab.Name); // added an attribute to identify which tab this button relates to, as haven't yet calculated the other parms to pass into activateSubTab()
                            if (counter == 0)
                            {
                                // if it's the first button, then disable it (this means it's active tab)
                                subTabButton.Disabled = true;
                            }
                            counter++;
                            subTabsPanel.Controls.Add(subTabButton);
                        }

                        break;

                    case SubTabType.DropDownList:

                        var subTabDropDownList = new DropDownList();
                        foreach (var tab in tabs)
                        {
                            subTabDropDownList.Items.Add(new ListItem(tab.Name));
                        }
                        subTabsPanel.Controls.Add(subTabDropDownList);

                        break;
                }

                subTabsPanel.ID = "subTabsPanel";
                this.Controls.Add(subTabsPanel);

                // Build the startup js
                var stringBuilder = new StringBuilder();
                stringBuilder.Append(@"

                    <script language='javascript' type='text/javascript'>

                        $(document).ready(function () {

                            // used to identify the containing element for the subTabs dropdown or button controls
                            var subTabsPanel = $('div#" + subTabsPanel.ClientID + @"');

                            // the main tab anchor in which the sub tabs datatype has been placed
                            var hostTabAnchor = $('li#' + $(subTabsPanel).parentsUntil('div.tabpagescrollinglayer', 'div.tabpageContent').parent().attr('id').replace('layer_contentlayer', '') + ' > a');

                            // init the first sub tab, and if it's already lit (by Umbraco) then pass in true on the last param so that it's toggled into action
                            activateSubTab(hostTabAnchor, subTabsPanel, '" + this.options.SubTabType.ToString() + @"', $(hostTabAnchor).parent('li').hasClass('tabOn'));

                            // TODO: loop though subtabs, and if any have 'tabOn' then init with that tab caption

                            // when the defult host tab is clicked - true passed as final param to indicate that the tab is to be activated
                            $(hostTabAnchor).click(function() { activateSubTab(this, subTabsPanel, '" + this.options.SubTabType.ToString() + @"', true); });
                    ");

                switch (this.options.SubTabType)
                {
                    case SubTabType.Buttons:

                        stringBuilder.Append(@"

                            // look for all buttons that are children of the subTabsPanel, and update their click event
                            $(subTabsPanel).children('button').click(function() {

                                // enable all buttons
                                $(subTabsPanel).children('button').removeAttr('disabled');

                                // disable the button being clicked (this allows us to also identify which tab should be activated within the activateSubTab method - or set a flag ?)
                                $(this).attr('disabled', true);

                                // activate the sub tab
                                activateSubTab(hostTabAnchor, subTabsPanel, '" + SubTabType.Buttons.ToString() + @"', true);

                                // prevent the button from causing a submit
                                return false;
                            });

                        ");

                        break;

                    case SubTabType.DropDownList:

                        stringBuilder.Append(@"

                            // find the drop down as a child element of the subTabsPanel (there should only be one select element)
                            $(subTabsPanel).children('select').eq(0).change(function() {

                                activateSubTab(hostTabAnchor, subTabsPanel, '" + SubTabType.DropDownList.ToString() + @"', true);

                            });

                        ");

                        break;
                }

                foreach (var tab in tabs)
                {
                    // Hide the regular Umbraco tabs
                    stringBuilder.Append(@"
                               $('span > nobr')
                                    .filter(function () {
                                        return $(this).html() == '"+ tab.Name + @"';
                                    })
                                    .parentsUntil('li', 'a').parent().hide();
                        ");
                }

                // Close the script string
                stringBuilder.Append(@"
                            });
                        </script>
                    ");

                ScriptManager.RegisterStartupScript(this, typeof(SubTabsDataEditor), this.ClientID + "_init", stringBuilder.ToString(), false);
            }
        }
 private void AddNewButton(HtmlGenericControl container)
 {
     using (HtmlButton newButton = new HtmlButton())
     {
         newButton.ID = "AddNewButton";
         newButton.Attributes.Add("class", "ui button");
         newButton.Attributes.Add("onclick",
             "window.location='/Modules/Finance/Entry/JournalVoucher.mix';return false;");
         newButton.InnerHtml = "<i class='icon plus'></i>" + Titles.NewJournalEntry;
         container.Controls.Add(newButton);
     }
 }
 private void AddReconcileButton(HtmlGenericControl container)
 {
     using (HtmlButton flagButton = new HtmlButton())
     {
         flagButton.ID = "ReconcileButton";
         flagButton.Attributes.Add("class", "ui button");
         flagButton.Attributes.Add("onclick", "return showReconcileWindow();");
         flagButton.InnerHtml = "<i class='circle notched icon'></i>" + Titles.Reconcile;
         container.Controls.Add(flagButton);
     }
 }
Exemple #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["No.Empleado"] == null)
        {
            Response.Redirect("login.aspx");
        }
        //if (Session["permisos"].ToString() != "Admin")
        //{
        //    liUsuario.Visible = false;
        //}

        if (Request["seleccionarVisita"] != null)
        {
            Response.Redirect("Visita.aspx?idVisita=" + Request["seleccionarVisita"]);
        }

        if (!IsPostBack)
        {
            RequisDrop.SelectedValue = "todas";
        }
        if (Session["Permisos"].ToString() == "Requi")
        {
            RequisDrop.Visible = false;
        }

        /*En los siguientes GridView se muestran las visitas que sean registrado filtrandolas entre pendientes y no pendientes
         * colocando todas las requisiciones si es aprobador */

        //GridView1(PENDIENTES)
        string        con      = ConfigurationManager.ConnectionStrings["IDDVisitas"].ConnectionString;
        SqlConnection conexion = new SqlConnection(con);

        conexion.Open();

        string que = @"SET LANGUAGE Spanish
    SELECT IdVisita, 
    ([nombreEmple] + ' ' + [apellido1] + ' ' + [apellido2] + ' (' + [No.Empleado_Requi] + ')') AS [Requisitor],
    [Nombre_Visitante] AS [Visitante],
    [Nombre_compania] AS [Compañia],
    ([Ciudad]+', ' +[Estado])AS [Ciudad-Estado],
    [Proposito_Visita] AS [Proposito de la visita],
    CASE WHEN [Aprobado] = 1
    THEN
    'Aprobado'
    ELSE
    'Rechazado'
    END
    AS [Aprobado],
    DATENAME(DD,Fecha_requi)
    + ' de ' 
    + DATENAME(mm, Fecha_requi) 
    + ' de ' 
    + DATENAME(YYYY,Fecha_requi)
    AS [Fecha] 
    FROM [Visitantes] WHERE [Abierto] = 0  ";

        /*Filtro del DropDownList*/
        if (RequisDrop.SelectedValue == "mias")
        {
            que += " AND [No.Empleado_Requi] = '" + Session["No.Empleado"].ToString() + "'";
        }
        if (RequisDrop.SelectedValue == "ajenas")
        {
            que += " AND [No.Empleado_Requi] != '" + Session["No.Empleado"].ToString() + "'";
        }

        /*Cuando se es requisitor se ejecuta esta condicion para que solamente muuestre las requisiciones que el a realizado esto por medio del numero de empleado*/
        if (Session["permisos"].ToString() == "Requi")
        {
            que += " AND [No.Empleado_Requi] = '" + Session["No.Empleado"].ToString() + "'";
        }

        SqlCommand    conx  = new SqlCommand(que, conexion);
        SqlDataReader slqDR = conx.ExecuteReader();

        GridView1.DataSource = slqDR;
        if (!IsPostBack)
        {
            BoundField columnaSeleccionar = new BoundField();
            columnaSeleccionar.HeaderText = "";
            GridView1.Columns.Add(columnaSeleccionar);
        }
        GridView1.DataBind();
        slqDR.Close();

        slqDR = conx.ExecuteReader();
        var contador0 = 0;

        while (slqDR.Read())
        {
            var celdaSeleccionar = GridView1.Rows[contador0].Cells[0];
            System.Web.UI.HtmlControls.HtmlButton botonSeleccionar = new System.Web.UI.HtmlControls.HtmlButton();
            botonSeleccionar.Attributes.Add("value", slqDR["IdVisita"].ToString());
            botonSeleccionar.Attributes.Add("name", "seleccionarVisita");
            botonSeleccionar.Attributes.Add("class", "fa fa-eye buttonSpecial");
            //botonSeleccionar.InnerHtml = "Ver";
            celdaSeleccionar.Controls.Add(botonSeleccionar);
            contador0++;
        }
        conexion.Close();

        //GridView2 (NO PENDIENTES)
        string        conn      = ConfigurationManager.ConnectionStrings["IDDVisitas"].ConnectionString;
        SqlConnection conexion1 = new SqlConnection(con);

        conexion.Open();
        string que2 = @" SET LANGUAGE Spanish
SELECT IdVisita,
([nombreEmple] + ' ' + [apellido1] + ' ' + [apellido2] + ' (' + [No.Empleado_Requi] + ')') AS [Requisitor],
[Nombre_Visitante] AS [Visitante], [Nombre_compania] AS [Compañia], 
([Ciudad]+', ' +[Estado])AS [Ciudad-Estado],
[Proposito_Visita] AS [Proposito de la visita],
DATENAME(DD,Fecha_requi)
+ ' de ' 
+ DATENAME(mm, Fecha_requi) 
+ ' de ' 
+ DATENAME(YYYY,Fecha_requi)
AS [Fecha] FROM [Visitantes] WHERE [Abierto] = 1 ";

        /*Filtro del DropDownList*/
        if (RequisDrop.SelectedValue == "mias")
        {
            que2 += " AND [No.Empleado_Requi] = '" + Session["No.Empleado"].ToString() + "'";
        }
        if (RequisDrop.SelectedValue == "ajenas")
        {
            que2 += " AND [No.Empleado_Requi] != '" + Session["No.Empleado"].ToString() + "'";
        }

        /*Cuando se es requisitor se ejecuta esta condicion para que solamente muuestre las requisiciones que el a realizado esto por medio del numero de empleado*/
        if (Session["permisos"].ToString() == "Requi")
        {
            que2 += " AND [No.Empleado_Requi] = '" + Session["No.Empleado"].ToString() + "'";
        }
        SqlCommand    con1   = new SqlCommand(que2, conexion);
        SqlDataReader slqDR1 = con1.ExecuteReader();

        GridView2.DataSource = slqDR1;
        if (!IsPostBack)
        {
            BoundField columnaSeleccionar = new BoundField();
            columnaSeleccionar.HeaderText = "";
            GridView2.Columns.Add(columnaSeleccionar);
        }
        GridView2.DataBind();
        slqDR1.Close();

        slqDR1 = con1.ExecuteReader();
        var contadorNp0 = 0;

        while (slqDR1.Read())
        {
            var celdaSeleccionar = GridView2.Rows[contadorNp0].Cells[0];
            System.Web.UI.HtmlControls.HtmlButton botonSeleccionar = new System.Web.UI.HtmlControls.HtmlButton();
            botonSeleccionar.Attributes.Add("value", slqDR1["IdVisita"].ToString());
            botonSeleccionar.Attributes.Add("name", "seleccionarVisita");
            botonSeleccionar.Attributes.Add("class", "fa fa-eye buttonSpecial");
            //botonSeleccionar.InnerHtml = "Ver";
            celdaSeleccionar.Controls.Add(botonSeleccionar);
            contadorNp0++;
        }

        conexion.Close();
    }
        private void CreateOKButton(HtmlGenericControl container)
        {
            using (HtmlButton okButton = new HtmlButton())
            {
                okButton.ID = "OKButton";
                okButton.Attributes.Add("class", "ui small red loading disabled button");
                okButton.Attributes.Add("onclick", "return false;");
                okButton.InnerText = Titles.OK;

                container.Controls.Add(okButton);
            }
        }
 private void AddPrintButton(HtmlGenericControl container)
 {
     using (HtmlButton printButton = new HtmlButton())
     {
         printButton.ID = "PrintButton";
         printButton.Attributes.Add("class", "ui button");
         printButton.Attributes.Add("onclick", "return false");
         printButton.InnerHtml = "<i class='icon print'></i>" + Titles.Print;
         container.Controls.Add(printButton);
     }
 }
Exemple #28
0
        /// <summary>
        /// Create the filter textbox control
        /// </summary>
        private Control CreateFilterTextBoxControl()
        {
            // Do all the work only if the control is visible
            if (Visible)
            {
                var controlClientID = this.Control.ClientID;
                var controlClientIDDataField = controlClientID + DataField;

                var divFilter = new HtmlGenericControl("div");
                divFilter.Attributes.Add("class", controlClientID + "Filters");
                divFilter.Attributes.Add("style", "display: none;");

                var inputPrependClass = ((GridViewEx)this.Control).BootstrapVersion >= 3
                    ? "input-group input-group-sm"
                    : "input-prepend";

                var divInputPrepend = new HtmlGenericControl("div");
                divInputPrepend.Attributes.Add("class", inputPrependClass);

                var divBtnGroup = new HtmlGenericControl("div");
                divBtnGroup.Attributes.Add("class", ((GridViewEx)this.Control).BootstrapVersion >= 3
                    ? "input-group-btn"
                    : "btn-group");

                var icon = ((GridViewEx)this.Control).BootstrapVersion >= 3
                    ? "glyphicon glyphicon-filter"
                    : "icon-filter";

                var btnClass = ((GridViewEx)this.Control).BootstrapVersion >= 3
                    ? "btn btn-default"
                    : "btn";

                var btnFilter = new HtmlButton();
                btnFilter.Attributes.Add("class", btnClass + " dropdown-toggle");
                btnFilter.Attributes.Add("title", "Filter By");
                btnFilter.Attributes.Add("data-toggle", "dropdown");
                btnFilter.InnerHtml = "<i class=\"" + icon + "\"></i>";
                divBtnGroup.Controls.Add(btnFilter);

                var ulFilter = new HtmlGenericControl("ul");
                ulFilter.Attributes.Add("class", "dropdown-menu");

                var txtBox = new TextBox
                {
                    ID = "txt" + controlClientIDDataField,
                    ClientIDMode = ClientIDMode.Static,
                    AutoPostBack = true,
                    CssClass = ((GridViewEx)this.Control).BootstrapVersion >= 3
                        ? "form-control col-md-1"
                        : "span1"
                };

                var hiddenField = new HiddenField
                {
                    ID = "hf" + controlClientIDDataField,
                    ClientIDMode = ClientIDMode.Static
                };

                var liFilter = new HtmlGenericControl("li");
                liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '= ');\">Is equal to</a>";
                ulFilter.Controls.Add(liFilter);

                liFilter = new HtmlGenericControl("li");
                liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '!= ');\">Is not equal to</a>";
                ulFilter.Controls.Add(liFilter);

                // Check the data format to add the correct filter expressions
                if (DataFormat == DataFormatEnum.Number
                    || DataFormat == DataFormatEnum.Currency
                    || DataFormat == DataFormatEnum.Hour
                    || DataFormat == DataFormatEnum.Percentage
                    || DataFormat == DataFormatEnum.Date
                    || DataFormat == DataFormatEnum.ShortDate)
                {
                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '> ');\">Is greater than</a>";
                    ulFilter.Controls.Add(liFilter);

                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '>= ');\">Is greater than or equal to</a>";
                    ulFilter.Controls.Add(liFilter);

                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '< ');\">Is less than</a>";
                    ulFilter.Controls.Add(liFilter);

                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '<= ');\">Is less than or equal to</a>";
                    ulFilter.Controls.Add(liFilter);
                }
                else
                {
                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '* ');\">Contains</a>";
                    ulFilter.Controls.Add(liFilter);

                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '!* ');\">Not contains</a>";
                    ulFilter.Controls.Add(liFilter);

                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '˄ ');\">Starts with</a>";
                    ulFilter.Controls.Add(liFilter);

                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '˅ ');\">Ends with</a>";
                    ulFilter.Controls.Add(liFilter);

                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '!˄ ');\">Not starts with</a>";
                    ulFilter.Controls.Add(liFilter);

                    liFilter = new HtmlGenericControl("li");
                    liFilter.InnerHtml = "<a href=\"javascript:GVEXSaveSearchExp('" + hiddenField.ClientID + "', '" + txtBox.ClientID + "', '!˅ ');\">Not ends with</a>";
                    ulFilter.Controls.Add(liFilter);
                }

                divBtnGroup.Controls.Add(ulFilter);
                divInputPrepend.Controls.Add(divBtnGroup);

                txtBox.TextChanged += new EventHandler(txtBox_TextChanged);
                divInputPrepend.Controls.Add(txtBox);
                divInputPrepend.Controls.Add(hiddenField);

                ((GridViewEx)this.Control).JSScript += (DataFormat == DataFormatEnum.Date || DataFormat == DataFormatEnum.ShortDate)
                    ? @"
                    function " + controlClientIDDataField + @"Function() {
                        $('#" + txtBox.ClientID + @"').datepicker().on('changeDate', function (ev) {
                            var date = new Date(ev.date);
                            if ($('#" + hiddenField.ClientID + @"').val().indexOf(date.format('" + ((GridViewEx)this.Control).CultureInfo.DateTimeFormat.FullDateTimePattern + @"')) === -1) {
                                $('#" + hiddenField.ClientID + @"').val($('#" + hiddenField.ClientID + @"').val() + date.format('" + ((GridViewEx)this.Control).CultureInfo.DateTimeFormat.FullDateTimePattern + @"'));

                                $('#" + txtBox.ClientID + @"').datepicker('hide');
                                $('#" + txtBox.ClientID + @"').change();
                            }
                        });
                    }"
                    : @"
                    function " + controlClientIDDataField + @"Function() {
                        $('#" + txtBox.ClientID + @"').removeAttr('onkeypress');
                        var oldOnChange = $('#" + txtBox.ClientID + @"').attr('onchange');
                        if (typeof oldOnChange != 'undefined') {
                            var onChange = '$(\'#" + hiddenField.ClientID + @"\').val($(\'#" + hiddenField.ClientID + @"\').val() + $(\'#" + txtBox.ClientID + @"\').val());';
                            $('#" + txtBox.ClientID + @"').attr('onchange', onChange + oldOnChange.substring(oldOnChange.indexOf('setTimeout')));
                        }
                    }";

                ((GridViewEx)this.Control).JSScriptEndRequestHandler += controlClientIDDataField + @"Function();";
                ((GridViewEx)this.Control).JSScriptDocumentReady += controlClientIDDataField + @"Function();";

                divFilter.Controls.Add(divInputPrepend);

                return divFilter;
            }
            else
                return new Control();
        }
 private void AddFlagButton(HtmlGenericControl container)
 {
     using (HtmlButton flagButton = new HtmlButton())
     {
         flagButton.ID = "FlagButton";
         flagButton.Attributes.Add("class", "ui button");
         flagButton.Attributes.Add("onclick", "return false");
         flagButton.InnerHtml = "<i class='icon flag'></i>" + Titles.Flag;
         container.Controls.Add(flagButton);
     }
 }
		public void InnerText3 () {
			HtmlButton c = new HtmlButton ();
			LiteralControl x = new LiteralControl ();
			x.Text = "FFF";
			c.Controls.Add (x);
			Assert.AreEqual("FFF", c.InnerText);
		}
        private void CreateInitializeButton(HtmlGenericControl container)
        {
            using (HtmlButton initializeButton = new HtmlButton())
            {
                initializeButton.ID = "InitializeButton";

                if (this.status.IsInitialized)
                {
                    initializeButton.Attributes.Add("class", "ui blue disabled button");
                }
                else
                {
                    initializeButton.Attributes.Add("class", "ui blue button");
                }

                initializeButton.Attributes.Add("onclick", "return false;");
                initializeButton.Attributes.Add("data-popup", ".initialize");

                using (HtmlGenericControl i = new HtmlGenericControl("i"))
                {
                    i.Attributes.Add("class", "icon alarm");
                    initializeButton.Controls.Add(i);
                }

                using (Literal buttonText = new Literal())
                {
                    buttonText.Text = Titles.InitializeDayEnd;
                    initializeButton.Controls.Add(buttonText);
                }

                container.Controls.Add(initializeButton);
            }
        }
		public void InnerText4 () {
			HtmlButton c = new HtmlButton ();
			LiteralControl x = new LiteralControl ();
			x.Text = "FFF";
			c.Controls.Add (x);
			LiteralControl x2 = new LiteralControl ();
			x2.Text = "BBB";
			c.Controls.Add (x2);

			string s = c.InnerText;
		}
        private void CreatePerformEODButton(HtmlGenericControl container)
        {
            using (HtmlButton performEODButton = new HtmlButton())
            {
                performEODButton.ID = "PerformEODButton";

                if (this.status.IsInitialized)
                {
                    performEODButton.Attributes.Add("class", "ui red button");
                }
                else
                {
                    performEODButton.Attributes.Add("class", "ui red disabled button");
                }

                performEODButton.Attributes.Add("onclick", "return false;");
                performEODButton.Attributes.Add("data-popup", ".eod");

                using (HtmlGenericControl i = new HtmlGenericControl("i"))
                {
                    i.Attributes.Add("class", "icon wizard");
                    performEODButton.Controls.Add(i);
                }

                using (Literal buttonText = new Literal())
                {
                    buttonText.Text = Titles.PerformEODOperation;
                    performEODButton.Controls.Add(buttonText);
                }

                container.Controls.Add(performEODButton);
            }
        }
        private void setupChildControls()
        {
            HyperLink _logoImageLink = new HyperLink();

            _logoImageLink.ImageUrl = "/Umbraco/Api/Resource/GetEmbededPng?filename=settings-logo.png";
            _logoImageLink.NavigateUrl = "http://dejanstojanovic.net/umbraco-googlemap-editor";
            _logoImageLink.Target = "_blank";
            _logoImageLink.ID = "logoImage";
            PropertyPanel propertyPanel = new PropertyPanel();
            propertyPanel.Text = string.Empty;
            propertyPanel.Controls.Add(_logoImageLink);
            Controls.Add(propertyPanel);

            _txtWidth = new TextBox();
            _txtWidth.ID = "txtWidth";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Width & Height";
            propertyPanel.Controls.Add(_txtWidth);
            AddRequiredValidator(_txtWidth);

            propertyPanel.Controls.Add(new Literal() { Text = " x " });

            _txtHeight = new TextBox();
            _txtHeight.ID = "txtHeight";
            propertyPanel.Controls.Add(_txtHeight);
            AddRequiredValidator(_txtHeight);
            Controls.Add(propertyPanel);

            _txtZoom = new TextBox();
            _txtZoom.ID = "txtZoom";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Zoom";
            propertyPanel.Controls.Add(_txtZoom);
            AddRequiredValidator(_txtZoom);
            Controls.Add(propertyPanel);

            _cbSingleLocation = new CheckBox();
            _cbSingleLocation.ID = "cbSingleLocation";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Single location";
            propertyPanel.Controls.Add(_cbSingleLocation);
            Controls.Add(propertyPanel);

            _cbSearchBox = new CheckBox();
            _cbSearchBox.ID = "cbSearchBox";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Search box";
            propertyPanel.Controls.Add(_cbSearchBox);
            Controls.Add(propertyPanel);

            _cbRichText = new CheckBox();
            _cbRichText.ID = "cbRichText";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Rich text editor";
            propertyPanel.Controls.Add(_cbRichText);
            Controls.Add(propertyPanel);

            _txtCenterLatitude = new TextBox();
            _txtCenterLatitude.ID = "txtCenterLatitude";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Center latitude & longitude";
            propertyPanel.Controls.Add(_txtCenterLatitude);
            AddRequiredValidator(_txtCenterLatitude);

            propertyPanel.Controls.Add(new Literal() { Text = " : " });
            _txtCenterLongitude = new TextBox();
            _txtCenterLongitude.ID = "txtCenterLongitude";
            propertyPanel.Controls.Add(_txtCenterLongitude);
            AddRequiredValidator(_txtCenterLongitude);

            Controls.Add(propertyPanel);

            HtmlButton _htmlLocationButton = new HtmlButton();
            _htmlLocationButton.InnerText = "use my current location";
            _htmlLocationButton.ID = "btnGetLocation";
            _htmlLocationButton.Attributes.Add("class", "current-location");
            _htmlLocationButton.Attributes.Add("type", "button");
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "&nbsp;";
            propertyPanel.Controls.Add(_htmlLocationButton);
            Controls.Add(propertyPanel);

            _cblDrawingTools = new CheckBoxList();
            _cblDrawingTools.ID = "cblDRawingTools";

            _cblDrawingTools.Items.Add(new ListItem("Marker", "marker"));
            _cblDrawingTools.Items.Add(new ListItem("Polyline", "polyline"));
            _cblDrawingTools.Items.Add(new ListItem("Polygon", "polygon"));
            _cblDrawingTools.Items.Add(new ListItem("Circle", "circle"));
            _cblDrawingTools.Items.Add(new ListItem("Rectangle", "rectangle"));

            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Drawing tools";
            propertyPanel.Controls.Add(_cblDrawingTools);
            Controls.Add(propertyPanel);

            _cbZoomControl = new CheckBox();
            _cbZoomControl.ID = "cbZoomControl";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Zoom control";
            propertyPanel.Controls.Add(_cbZoomControl);
            Controls.Add(propertyPanel);

            _cbPanControl = new CheckBox();
            _cbPanControl.ID = "cbPanControl";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Pan control";
            propertyPanel.Controls.Add(_cbPanControl);
            Controls.Add(propertyPanel);

            _cbStreetViewControl = new CheckBox();
            _cbStreetViewControl.ID = "cbStreetViewControl";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "StreetView control";
            propertyPanel.Controls.Add(_cbStreetViewControl);
            Controls.Add(propertyPanel);

            _cbScaleControl = new CheckBox();
            _cbScaleControl.ID = "cbScaleControl";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Scale control";
            propertyPanel.Controls.Add(_cbScaleControl);
            Controls.Add(propertyPanel);

            _ddlLanguages = new DropDownList();
            _ddlLanguages.ID = "ddlLanguages";
            propertyPanel = new PropertyPanel();
            propertyPanel.Text = "Language in map editor";
            foreach (string supportedLanguage in Extensions.CultureInfoExtensions.GoogleMapsSupportedLanguageCodes)
            {
                CultureInfo culture;
                try
                {
                    culture = new CultureInfo(supportedLanguage);
                    _ddlLanguages.Items.Add(new ListItem(culture.EnglishName, supportedLanguage));
                }
                catch
                {
                    _ddlLanguages.Items.Add(new ListItem(supportedLanguage, supportedLanguage));
                }
            }
            propertyPanel.Controls.Add(_ddlLanguages);
            Controls.Add(propertyPanel);
        }
        private TableRow GetArticleSearchRow()
        {
            TableRow row = new TableRow();
            TableCell cell = new TableCell();
            Panel userControlGroup = new Panel();

            dialogButton = new HtmlButton();

            articleID = new HiddenField();
            articleID.ID = "articleID";
            articleTitle = new HiddenField();
            articleTitle.ID = "articleTitle";
            dialogButton.ID = "btnsearch";
            dialogButton.Attributes.Add("class", "UserButton");

            StringBuilder text = new StringBuilder();
            text.Append("<script type=\"text/javascript\">");
            text.Append("function CloseCallback(dialogResult, returnValue)");
            text.Append("{");
            text.Append("var articleIDControl = document.getElementById('" + base.ClientID + "_" + articleID.ClientID + "');");
            text.Append("var articleTitleControl = document.getElementById('" + base.ClientID + "_" + articleTitle.ClientID + "');");
            text.Append("var articleArray = returnValue.split('|');");
            text.Append("articleIDControl.value = articleArray[0];");
            text.Append("articleTitleControl.value = articleArray[1];");
            text.Append(GetPostBack());
            text.Append("}");
            text.Append("function ToggleSearch(enabled)");
            text.Append("{");
            text.Append("var btnSearchControl = document.getElementById('" + base.ClientID + "_" + dialogButton.ClientID + "');");
            text.Append("btnSearchControl.disabled=enabled;");
            text.Append("var dropdownControl = document.getElementById('" + base.ClientID + "_" + publishAtDropdown.ClientID + "');");
            text.Append("dropdownControl.disabled=!enabled;");
            text.Append("}");
            text.Append("</script>");

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "callbackscript", text.ToString(), false);

            articleID.Value = this.webpart.FilterValue1;

            dialogButton.InnerText = "...";

            string serverRelativeUrl;
            if (SPContext.Current.Web.ServerRelativeUrl == "/")
                serverRelativeUrl = "";
            else
                serverRelativeUrl = SPContext.Current.Web.ServerRelativeUrl;

            dialogButton.Attributes.Add("onclick", "javascript: OpenDialog('" + serverRelativeUrl + "/_layouts/NCNewssiteApplicationPages/ArticleSelectDialog.aspx');");
            dialogButton.Attributes.Add("type", "Button");
            userControlGroup.CssClass = "UserControlGroup";
            displayArticleTitle = new LiteralControl("tmp title");

            userControlGroup.Controls.Add(articleID);
            userControlGroup.Controls.Add(articleTitle);

            optManual = new RadioButton();
            optManual.Text = "Select article ";
            optManual.GroupName = "nc-contentquery-search";

            userControlGroup.Controls.Add(optManual);
            userControlGroup.Controls.Add(dialogButton);

            cell.Controls.Add(userControlGroup);

            row.Cells.Add(cell);
            return row;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["No.Empleado"] == null)
        {
            Response.Redirect("login.aspx");
        }

        if (Session["permisos"].ToString() != "Admin")
        {
            Response.Redirect("login.aspx");
        }

        /*Elimina una celda del GridView, tambien lo elimina ese usuario de la Bd*/
        if (Request["eliminarUsuario"] != null)
        {
            var db = Database.Open("IDDVisitas");
            db.Execute("DELETE FROM [Usuarios] WHERE [Usuario] = @0", Request["eliminarUsuario"]);
            db.Close();
        }

        /*Llena el GridView con los datos de los usuarios que esten registrados en la BD*/
        string        usuBD    = ConfigurationManager.ConnectionStrings["IDDVisitas"].ConnectionString;
        SqlConnection conexion = new SqlConnection(usuBD);

        conexion.Open();
        string        que3      = @"SELECT [usuario] AS [Usuario], [permisos] AS [Permiso], 
        [email] AS [E-mail] FROM [usuarios]";
        SqlCommand    conxx     = new SqlCommand(que3, conexion);
        SqlDataReader sqlreader = conxx.ExecuteReader();

        UsuariosGrid.DataSource = sqlreader;

        /*Se crea el boton con sus atributos y se va agregadno a cada celda cuandno se ingresa un usuario nuevo*/
        if (!IsPostBack)
        {
            BoundField columnaEliminar = new BoundField();
            columnaEliminar.HeaderText = "";
            UsuariosGrid.Columns.Add(columnaEliminar);
        }

        UsuariosGrid.DataBind();
        sqlreader.Close();

        sqlreader = conxx.ExecuteReader();
        var contador = 0;

        while (sqlreader.Read())
        {
            var celdaEliminar = UsuariosGrid.Rows[contador].Cells[0];
            System.Web.UI.HtmlControls.HtmlButton botonEliminar = new System.Web.UI.HtmlControls.HtmlButton();
            botonEliminar.Attributes.Add("value", sqlreader["Usuario"].ToString());
            botonEliminar.Attributes.Add("name", "eliminarUsuario");
            botonEliminar.Attributes.Add("class", "fa fa-trash buttonSpecial");
            // botonEliminar.InnerHtml = "Eliminar";
            celdaEliminar.Controls.Add(botonEliminar);
            contador++;
        }
        conexion.Close();

        /*Se llenan los Items del DropDowListe con datos de la BD de la tabla permisos*/
        if (!IsPostBack)
        {
            var permiso = Database.Open("IDDVisitas");
            var per     = permiso.Query(@"
            SELECT '' AS [permisos], '' AS [descripcion]
            UNION
            SELECT * FROM [permisos]");
            foreach (var x in per)
            {
                ListItem item = new ListItem();
                item.Value = x["permisos"];
                item.Text  = x["descripcion"];
                Permiso.Items.Add(item);
            }
            permiso.Close();
        }
    }