本文介绍了如何在重定向时每次在aspx页面中动态添加按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个下拉列表,其中包含ac,nonac,delux项目。在按钮单击下一页并将文本框文本添加到动态创建的按钮但是我想添加按钮后,在aspx页面1的文本框中输入数据基于dropdown.i的选择从db使用阅读器evry时间检索buttontext它添加按钮和文本。但我想让它像下面。我应该根据我的选择类型添加。

假设:

ac:BUTTON123

NONAC:BUTTON233

DELUX:BUTTON234



我尝试过:



i have a dropdown which are having ac,nonac ,delux items in it.iam entering data in a textbox of aspx page 1 after button click its going to next page and adding textbox text to dynamically created button but i want add button based on selection of dropdown.i retrieved buttontext from db using reader evry time it adds button along with text .but i want to make it like below .how should i add based on my selection type.
suppose :
ac : BUTTON123
NONAC : BUTTON233
DELUX : BUTTON234

What I have tried:

  DropDownList1.Items.Add("AC");
            DropDownList1.Items.Add("NON-AC");
            DropDownList1.Items.Add("DELUX");

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text!= "")
            {
                string s = TextBox1.Text;
                Response.Redirect("WebForm2.aspx?val=" + TextBox1.Text);
            }

in aspx2

  protected void Page_Load(object sender, EventArgs e)
        {



            Button b = new Button();
            b.Text =Request.QueryString["val"];
           Panel1.Controls.Add(b);

推荐答案

protected void Button1_Click(object sender, EventArgs e)
       {
           string value = DropDownList1.SelectedItem.Value;
           Response.Redirect("WebForm2.aspx?val=" + value);

       }


这篇关于如何在重定向时每次在aspx页面中动态添加按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:38