当前位置: 首页>>代码示例>>C#>>正文


C# HiddenField类代码示例

本文整理汇总了C#中HiddenField的典型用法代码示例。如果您正苦于以下问题:C# HiddenField类的具体用法?C# HiddenField怎么用?C# HiddenField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HiddenField类属于命名空间,在下文中一共展示了HiddenField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateChildControls

    protected override void CreateChildControls()
    {
        _state = new HiddenField {ID = ID + "_state"};
        _state.ValueChanged += HandleLinkRequest;

        Controls.Add(_state);
    }
开发者ID:ssommerfeldt,项目名称:TAC_EAB,代码行数:7,代码来源:ClientLinkHandler.ascx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Set body to submit onload
        body.Attributes.Add("onload", "document.forms[0].submit()");

        // Set form action and method
        paypalForm.Action = "https://www.sandbox.paypal.com/cgi-bin/webscr"; // TEST URL
        paypalForm.Method = "POST";

        // Retrieve donations from the session
        var donations = BusinessLogic.Donation.GetDonations();

        // Determine donation type
        if (donations.Count() > 1)
        {
            this.processingType = ProcessingType.Cart;
        }
        else
        {
            if (donations.First().DonationType == "Special")
            {
                this.processingType = ProcessingType.OneTime;
            }
            else
            {
                this.processingType = ProcessingType.Recurring;
            }
        }

        // Create collection to store values in
        Dictionary<string, string> formValues = new Dictionary<string, string>();

        // Set default values
        formValues.Add("business", "[email protected]");
        formValues.Add("no_shipping", "2");
        formValues.Add("currency_code", "USD");
        formValues.Add("tax", "0");
        formValues.Add("no_note", "1");

        // Add type specific values to collection
        var addedFormValues = this.AddTypeSpecificValues(donations);
        addedFormValues.ToList().ForEach(x => formValues.Add(x.Key, x.Value));

        // Add hidden fields to form
        foreach (KeyValuePair<string, string> pair in formValues)
        {
            HiddenField field = new HiddenField();
            field.ID = (string)pair.Key;
            field.Value = (string)pair.Value;

            paypalForm.Controls.Add(field);
        }

        // Clear session so that donations are not saved when the user returns
        BusinessLogic.Donation.ClearDonations();
    }
开发者ID:OneMissionSociety,项目名称:OMS-Corporate-Website,代码行数:56,代码来源:ProcessDonations.aspx.cs

示例3: PopulateHiddenField

 /// <summary>
 /// Populates the value of the specified hidden field with the data
 /// associated with the specified querystring param. Populates the 
 /// field with an empty string if parameter does not exist.
 /// </summary>
 /// <param name="hiddenField">HiddenField to populate</param>
 /// <param name="queryStringParam">Query string parameter</param>
 private void PopulateHiddenField(HiddenField hiddenField, string queryStringParam)
 {
     if (!string.IsNullOrEmpty(Request.QueryString[queryStringParam]))
     {
         hiddenField.Value = Request.QueryString[queryStringParam];
     }
     else
     {
         hiddenField.Value = string.Empty;
     }
 }
开发者ID:jaytem,项目名称:minGit,代码行数:18,代码来源:DmsSync.aspx.cs

示例4: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (PreviousPage != null)
        {
            ob = (HiddenField)PreviousPage.FindControl("HiddenFieldconstituencyId");
        }
        if (ob != null)
        {

            Int16 constituencyId = Convert.ToInt16(ob.Value);
            loadmpdetails(constituencyId);

        }
    }
开发者ID:CoderAjay,项目名称:FinalWebrmp,代码行数:14,代码来源:mpprofile.aspx.cs

示例5: GridView1_RowDataBound

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         OperaterDropDownList = (DropDownList)e.Row.Cells[1].FindControl("selOperator");
         OperaterDropDownList.Attributes.Add("onchange", "OperatorChange(this);");
         // add by zy 20110107 start
         string fieldName = ((System.Data.DataRowView)(e.Row.DataItem)).Row.ItemArray[2].ToString();
         TextBox TBCondiction1 = (TextBox)e.Row.Cells[2].FindControl("txtCondition1");
         HtmlImage IBSelect = (HtmlImage)e.Row.Cells[3].FindControl("imgSelect");
         IBSelect.Attributes.Add("onclick", string.Format("topopmask('../SelectReportCondiction.aspx',800,450,'Select Report Condition','{0}','{1}');", TBCondiction1.ClientID, fieldName));
         // add by zy 20110107 end
         FieldTypeHiddenField = (HiddenField)e.Row.Cells[3].FindControl("hidFieldType");
         BoundOperater(OperaterDropDownList, FieldTypeHiddenField.Value);
     }
 }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:16,代码来源:ExecutiveReportCondition.aspx.cs

示例6: CreatePageControl

    private void CreatePageControl()
    {
        // Create dynamic controls here.
        btnNextPage = new Button();
        btnNextPage.ID = "btnNextPage";
        Form1.Controls.Add(btnNextPage);
        btnNextPage.Click += new System.EventHandler(btnNextPage_Click);

        btnPreviousPage = new Button();
        btnPreviousPage.ID = "btnPreviousPage";
        Form1.Controls.Add(btnPreviousPage);
        btnPreviousPage.Click += new System.EventHandler(btnPreviousPage_Click);

        btnGoPage = new Button();
        btnGoPage.ID = "btnGoPage";
        Form1.Controls.Add(btnGoPage);
        btnGoPage.Click += new System.EventHandler(btnGoPage_Click);

        HFD_CurrentPage = new HiddenField();
        HFD_CurrentPage.Value = "1";
        HFD_CurrentPage.ID = "HFD_CurrentPage";
        Form1.Controls.Add(HFD_CurrentPage);
    }
开发者ID:samuellin124,项目名称:cms,代码行数:23,代码来源:ServicePoints.aspx.cs

示例7: Page_Load

	protected void Page_Load(object sender, EventArgs e)
	{
		((BXAdminMasterPage)Page.Master).Title = Page.Title;

		if (userId > 0)
			BXRoleManager.SynchronizeProviderUserRoles(user.UserName, user.ProviderName);

		var filter = new BXFormFilter(
			new BXFormFilterItem("Active", true, BXSqlFilterOperators.Equal)
		);
		var roles = userId > 0 ? rolesToViewAndModify : rolesToCreate;
		if (roles.Length != 1 || roles[0] != 0)
			filter.Add(new BXFormFilterItem("Id", roles, BXSqlFilterOperators.In));

		BXRoleCollection rolesTmp = BXRoleManager.GetList(
			filter,
			new BXOrderBy_old("RoleName", "Asc")
		);

		foreach (int i in new[] { 1, 3, 2 })
		{
			var r = rolesTmp.Find(x => x.RoleId == i);
			if (r != null)
			{
				rolesTmp.Remove(r);
				rolesTmp.Insert(0, r);
			}
		}


		foreach (BXRole roleTmp in rolesTmp)
		{
			HtmlTableRow r1 = new HtmlTableRow();
			r1.VAlign = "top";

			HtmlTableCell c1 = new HtmlTableCell();
			CheckBox cb = new CheckBox();
			cb.ID = String.Format("tbCheck_{0}", roleTmp.RoleId.ToString());
			cb.Checked = false;
			c1.Controls.Add(cb);
			HiddenField hf = new HiddenField();
			hf.ID = String.Format("tbCheck_{0}_old", roleTmp.RoleId.ToString());
			hf.Value = "N";
			c1.Controls.Add(hf);
			r1.Cells.Add(c1);

			c1 = new HtmlTableCell();
			c1.InnerHtml = String.Format("<a href=\"AuthRolesEdit.aspx?name={0}\">{1}</a>", Server.UrlEncode(roleTmp.RoleName), Server.HtmlEncode(roleTmp.Title));
			r1.Cells.Add(c1);

			c1 = new HtmlTableCell();
			c1.Align = "center";
			c1.Style["padding-right"] = "10px";
			c1.Style["padding-left"] = "10px";
			TextBox tb1 = new TextBox();
			tb1.ID = String.Format("tbActiveFrom_{0}", roleTmp.RoleId.ToString());
			c1.InnerHtml = "c&nbsp;";
			c1.Controls.Add(tb1);
			hf = new HiddenField();
			hf.ID = String.Format("tbActiveFrom_{0}_old", roleTmp.RoleId.ToString());
			hf.Value = "";
			c1.Controls.Add(hf);
			r1.Cells.Add(c1);

			c1 = new HtmlTableCell();
			c1.Align = "center";
			tb1 = new TextBox();
			tb1.ID = String.Format("tbActiveTo_{0}", roleTmp.RoleId.ToString());
			c1.InnerHtml = string.Format("{0}&nbsp;", GetMessage("TabCellInnerHtml.To"));
			c1.Controls.Add(tb1);
			hf = new HiddenField();
			hf.ID = String.Format("tbActiveTo_{0}_old", roleTmp.RoleId.ToString());
			hf.Value = "";
			c1.Controls.Add(hf);
			r1.Cells.Add(c1);

			tblRoles.Rows.Add(r1);
		}

		if (!Page.IsPostBack)
			LoadData();

		if (userId > 0)
		{
			if (!missingProvider)
			{
				trPasswordQuestion.Style["display"] = (Membership.Providers[user.ProviderName].RequiresQuestionAndAnswer ? "" : "none");
				trPasswordAnswer.Style["display"] = (Membership.Providers[user.ProviderName].RequiresQuestionAndAnswer ? "" : "none");
			}
			else
			{
				trPasswordQuestion.Style["display"] = "none";
				trPasswordAnswer.Style["display"] = "none";
				trPassword.Style["display"] = "none";
				trNewPassword.Style["display"] = "none";
				trNewPasswordConf.Style["display"] = "none";
			}
		}
		else
		{
//.........这里部分代码省略.........
开发者ID:mrscylla,项目名称:volotour.ru,代码行数:101,代码来源:AuthUsersEdit.aspx.cs

示例8: CreatePageControl

    private void CreatePageControl()
    {
        // Create dynamic controls here.
        btnNextPage = new Button();
        btnNextPage.ID = "btnNextPage";
        btnNextPage.Height = 1;
        btnNextPage.Width = 1;
        Form1.Controls.Add(btnNextPage);
        btnNextPage.Click += new System.EventHandler(btnNextPage_Click);

        btnPreviousPage = new Button();
        btnPreviousPage.ID = "btnPreviousPage";
        Form1.Controls.Add(btnPreviousPage);
        btnPreviousPage.Click += new System.EventHandler(btnPreviousPage_Click);

        btnGoPage = new Button();
        btnGoPage.ID = "btnGoPage";
        Form1.Controls.Add(btnGoPage);
        btnGoPage.Click += new System.EventHandler(btnGoPage_Click);

        HFD_CurrentPage = new HiddenField();
        HFD_CurrentPage.Value = "1";
        HFD_CurrentPage.ID = "HFD_CurrentPage";
        Form1.Controls.Add(HFD_CurrentPage);

        HFD_CurrentSortField = new HiddenField();
        HFD_CurrentSortField.Value = "";
        HFD_CurrentSortField.ID = "HFD_CurrentSortField";
        Form1.Controls.Add(HFD_CurrentSortField);

        HFD_CurrentSortDir = new HiddenField();
        HFD_CurrentSortDir.Value = "asc";
        HFD_CurrentSortDir.ID = "HFD_CurrentSortDir";
        Form1.Controls.Add(HFD_CurrentSortDir);
    }
开发者ID:samuellin124,项目名称:cms,代码行数:35,代码来源:ChangeChurchEdit.aspx.cs

示例9: readPage

 public void readPage(SqlConnection con)
 {
     string value = Context.Request["it"];
     if (value == null)
         return;
     ((HiddenField)Master.FindControl("PageIndex")).Value = value;
     SqlCommand cmd = new SqlCommand("SELECT * FROM [Url] WHERE [it] = @it ORDER BY [index]", con);
     cmd.Parameters.AddWithValue("@it", value);
     SqlDataReader reader = cmd.ExecuteReader();
     for (int i = 1; reader.Read(); i++)
     {
         HiddenField hid = new HiddenField();
         hid.ID = "page" + i.ToString();
         hid.Value = reader["url"].ToString();
         Url.Controls.Add(hid);
     }
     reader.Close();
 }
开发者ID:The---onE,项目名称:dmtucao.com,代码行数:18,代码来源:it.aspx.cs

示例10: SetHiddenValues

    /// <summary>
    /// Sets array list values into hidden field.
    /// </summary>
    /// <param name="values">Arraylist of values to selection</param>
    /// <param name="field">Hidden field</param>
    private static void SetHiddenValues(ArrayList values, HiddenField actionsField, HiddenField hashField)
    {
        if (values != null)
        {
            if (actionsField != null)
            {
                // Build the list of actions
                StringBuilder sb = new StringBuilder();
                sb.Append("|");

                foreach (object value in values)
                {
                    sb.Append(value);
                    sb.Append("|");
                }

                // Action IDs
                string actions = sb.ToString();
                actionsField.Value = actions;

                // Actions hash
                if (hashField != null)
                {
                    hashField.Value = ValidationHelper.GetHashString(actions);
                }
            }
        }
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:33,代码来源:UniGrid.ascx.cs

示例11: GetHiddenValues

 /// <summary>
 /// Returns array list from hidden field.
 /// </summary>
 /// <param name="field">Hidden field with values separated with |</param>
 private static ArrayList GetHiddenValues(HiddenField field)
 {
     string hiddenValue = field.Value.Trim('|');
     ArrayList list = new ArrayList();
     string[] values = hiddenValue.Split('|');
     foreach (string value in values)
     {
         if (!list.Contains(value))
         {
             list.Add(value);
         }
     }
     list.Remove("");
     return list;
 }
开发者ID:KuduApps,项目名称:Kentico,代码行数:19,代码来源:UniGrid.ascx.cs

示例12: ClearHiddenValues

 /// <summary>
 /// Clears all selected items from hidden values.
 /// </summary>
 /// <param name="field">Hidden field</param>
 private static void ClearHiddenValues(HiddenField field)
 {
     if (field != null)
     {
         field.Value = "";
     }
 }
开发者ID:KuduApps,项目名称:Kentico,代码行数:11,代码来源:UniGrid.ascx.cs

示例13: ValidateHiddenValues

 /// <summary>
 /// Validates values in hidden fields with corresponding hash.
 /// </summary>
 /// <param name="field">Hidden field with values separated with |</param>
 /// <param name="hashField">Hidden field containing hash of <paramref name="field"/></param>
 private static bool ValidateHiddenValues(HiddenField field, HiddenField hashField)
 {
     return ValidationHelper.ValidateHash(field.Value, hashField.Value, redirect: false);
 }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:9,代码来源:UniGrid.ascx.cs

示例14: GetHiddenValues

    /// <summary>
    /// Returns array list from hidden field.
    /// </summary>
    /// <param name="field">Hidden field with values separated with |</param>
    /// <param name="hashField">Hidden field containing hash of <paramref name="field"/></param>
    private static List<string> GetHiddenValues(HiddenField field, HiddenField hashField)
    {
        var result = new List<string>();

        if (ValidateHiddenValues(field, hashField))
        {
            result.AddRange(field.Value.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Distinct(StringComparer.InvariantCultureIgnoreCase).ToList());
        }

        return result;
    }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:16,代码来源:UniGrid.ascx.cs

示例15: ClearHiddenValues

 /// <summary>
 /// Clears all selected items from hidden values.
 /// </summary>
 /// <param name="field">Hidden field</param>
 private static void ClearHiddenValues(HiddenField field)
 {
     if (field != null)
     {
         field.Value = String.Empty;
     }
 }
开发者ID:dlnuckolls,项目名称:pfh-paypalintegration,代码行数:11,代码来源:UniGrid.ascx.cs


注:本文中的HiddenField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。