English 中文(简体)
如何在选定的指数ch缩活动中展示隐藏的文字箱?
原标题:How to show hidden textbox on dropdown selectedindex chnged event?

我在我的学校项目网站上创建登记表。 我已经给出了安全问题的下调菜单,如果使用者想要打上自己的问题,他/她可以选择其他问题,然后,一个文本箱将显示,我已设定的“<条码>可视距

我尝试了这一法典,但没有奏效,我没有哪儿失踪。

protected void selectques_SelectedIndexChanged(object sender, EventArgs e)
{
    if (selectques.Text == "Other")
    {
        alterquestion.Visible = true;
    }   
}

DropdownList:

<asp:DropDownList ID="selectques" runat="server" Height="25px" Width="254px" OnSelectedIndexChanged="selectques_SelectedIndexChanged">
    <asp:ListItem>Select a question?</asp:ListItem>
    <asp:ListItem> What is your pet name?</asp:ListItem>
    <asp:ListItem>Who is your first teacher?</asp:ListItem>
    <asp:ListItem>Which is your favourite movie?</asp:ListItem>
    <asp:ListItem>Whom you like most in your life?</asp:ListItem>
    <asp:ListItem>Other</asp:ListItem>
</asp:DropDownList>

Hidden TextBox:

<asp:TextBox ID="alterquestion" runat="server" Height="20px" Width="250px" Visible="false"></asp:TextBox>
最佳回答

DropDownList.Text Property given You S selectedValue of the 。 但是,根据您的清单,没有任何价值的领域。

you need to check selectques.SelectedItem.Text property to find your ListItem or you can add value field to your list items.

<asp:ListItem
    Text="Other"
    Value="Other"
/>

http://www.ohchr.org。

3. 德兰多·卡斯特巴卡(签名)

<asp:DropDownList ID="selectques" AutoPostBack= "True" runat="server" Height="25px" Width="254px" OnSelectedIndexChanged="selectques_SelectedIndexChanged">
问题回答

你们需要使用:

if (selectques.SelectedItem.Text == "Other")

这应当做到 the。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签