asp.net中的dropdownlist问题 [英] problem with dropdownlist in asp.net

查看:85
本文介绍了asp.net中的dropdownlist问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我希望如果用户在下拉列表中选择一个值..它必须显示在标签中但是 onselectedindexchanged 方法不会触发值但是如果我点击任何按钮出现在同一页面,然后价值显示在标签中..



欲望输出是 onselectedindexchanged 必须触发自己的价值



这里'是我的代码



i have a project where i want that if a user selects a value in the dropdownlist .. it must be shown in the label but the onselectedindexchanged method is not firing the values but if i click on any button present the same page then the value is being shown in the label..

the desire output is that the onselectedindexchanged must fire the value on its own

here''s my code

 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{

    string sdr= dropdownlist1.selectedvalue;
    label1.text= "Hi"+sdr;

 }





任何帮助表示赞赏。



thnk u



any help is appreciated.

Thnk u

推荐答案

AutoPostBack 的标记设置为true。
Set the tag of AutoPostBack to true.
AutoPostBack="true"

将解决问题。



祝你好运,

OI

will solve the issue.

Good luck,
OI


这篇关于asp.net中的dropdownlist问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆