如何设置dropdownlist的值

如何设置dropdownlist的值,第1张

设置数据表选中的值: dropdowslist.selectedIndex=-1 dropdownlist.Items.findbyvalue(你的值).selected=true 或 dropdownlist.Items.findbytext(你的值).selected=true for example: drop1.Items.FindByValue("5").Selected=truedrop1.Items...

设置数据表选中的值: dropdowslist.selectedIndex=-1 dropdownlist.Items.findbyvalue(你的值).selected=true 或 dropdownlist.Items.findbytext(你的值).selected=true for example: drop1.Items.FindByValue("5").Selected=truedrop1.Items.FindByText("hello").Selected=true

<li class="list-group-item">

@{

if (@ViewBag.key != "")

{

<input type="text" name="key" [email protected] class="form-control no-padding-hr" style="border-radius: 0" />

}

else

{

<input type="text" name="key" placeholder="请输入待搜索单位名称..." class="form-control no-padding-hr" style="border-radius: 0" />

}

}

</li>

<li class="list-group-item">

@Html.DropDownListFor(model =>model.CompanyNature, ViewBag.CompanyNature as IEnumerable<SelectListItem>)

</li>

<li class="list-group-item">

@Html.DropDownListFor(model =>model.CompanyBusiness, ViewBag.CompanyBusiness as IEnumerable<SelectListItem>)

</li>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/7894595.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-11
下一篇 2023-04-11

发表评论

登录后才能评论

评论列表(0条)

保存