本文介绍了当我在下拉列表中选择特定的选定值时,将显示modalpopup扩展器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码如下



课程费用&学生花费的时间Dropdownlist1



在下拉列表中选择的项目四个值将显示如下



优秀

好​​

公平





在上面的dropdownlist1中我们选择只有来自dropdownlist1的那个时候会显示modalpopup扩展程序弹出窗口。

在modalpopup extenderpopup中,一个文本框会出现不良原因的类型,然后单击确定按钮。



My code as follows

Value for course Fees & Time spent by student Dropdownlist1

In the dropdownlist selected item four values will be display as follows

Excellent
Good
Fair
Poor

In the above dropdownlist1 when we select the Poor only from the dropdownlist1 that time modalpopup extender popup will be display.
In the modalpopup extenderpopup one textbox will be there type for the Poor reason and click the ok button.

  int currentddl = -1;
  string SelectedDropdown = string.Empty;


  protected void Dropdownlist1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (Dropdownlist1.SelectedItem.ToString() == "Poor")
        {
            ModalPopupExtender1.TargetControlID = "Dropdownlist1";
            TxtNegativeFeedback.Text = "";
            currentddl = 0;
            SelectedDropdown = "ddlcourse";
            hfnegativefeedback.Value = currentddl.ToString();
            Negativepnlpopup();
            Negativepnlpopupfalse();
        }
    }

  private void Negativepnlpopup()
    {
            ModalPopupExtender1.TargetControlID = SelectedDropdown.ToString();
            ModalPopupExtender1.Show();
            Pnlnegativefeedback.Visible = true;
    }


 private void Negativepnlpopupfalse()
    {
        if (Dropdownlist1.SelectedItem.ToString() == "Excellent")
        {
            Pnlnegativefeedback.Visible = false;
            return;
        }

        if (Dropdownlist1.SelectedItem.ToString() == "Very Good")
        {
            Pnlnegativefeedback.Visible = false;
            return;
        }

        if (Dropdownlist1.SelectedItem.ToString() == "Good")
        {
            Pnlnegativefeedback.Visible = false;
            return;
        }

        if (Dropdownlist1.SelectedItem.ToString() == "Fair")
        {
            pnlPopup.Visible = false;
            return;
        }
}





在运行模式下,当我们在dorpdownlist1中选择Dropdownlist1时,假设我选择了Good那个时候modalpopupextender会显示。

i不想显示modalpopupextender。只有当我在dropdownlist1中选择穷人时,才会看到modalpopupextender。



为此我编写代码。



但是我的代码我犯了什么错误?



请帮帮我。



问候,

narasiman P.



In the run mode when we select the Dropdownlist1 in that dorpdownlist1 suppose i select the Good that time modalpopupextender will show.
i don't want to display the modalpopupextender. only when i select the Poor in the dropdownlist1 that time only modalpopupextender will be visible.

for that i written the code.

But my code what is the mistake i made?

Please help me.

Regards,
narasiman P.

推荐答案

Quote:

获取列表控件中索引最低的所选项目。

Gets the selected item with the lowest index in the list control.

它可以帮到你 SelectedItem ,它有两个属性文本



正在检查文本,所以你的代码应该是......

It gets you the SelectedItem which has two properties Text and Value.

As you are checking with Text, so your code should be like...

if (Dropdownlist1.SelectedItem.Text == "Poor")
{
    // Your code here.  
}


这篇关于当我在下拉列表中选择特定的选定值时,将显示modalpopup扩展器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 15:58