如何将下拉列表值设置为默认值 [英] How to set dropdown value to default

查看:116
本文介绍了如何将下拉列表值设置为默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些asp.net下拉列表,例如

i have asp.net dropdownlist some thing like

<asp:DropDownList ID="reservation1"  CssClass="tel" runat="server">
                             <asp:ListItem Value="0">--Select--</asp:ListItem>
                             <asp:ListItem Value="1">General</asp:ListItem>
                             <asp:ListItem Value="2">SC/ST</asp:ListItem>
                             <asp:ListItem Value="3">Others</asp:ListItem>
                         </asp:DropDownList>



在form.after提交详细信息后我想在下面的代码中设置上拉下限值或0或--Select-- />


我尝试了什么:



i已经尝试过makeig AppendDataBoundItems = true仍然无法得到它


inside form.after submitting details i want to set above dropdown value or to "0" or "--Select--" in code behind

What I have tried:

i have tried by makeig AppendDataBoundItems=true still not able to get it

推荐答案

使用 SelectedIndex [ ^ ] property

use SelectedIndex [^] property
reservation1.SelectedIndex = 0;


这篇关于如何将下拉列表值设置为默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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