如何删除文本框并将下拉框放在asp.net中

时间:2022-11-04 03:14:41

How to remove a textbox and put the dropdown box in asp.net

如何删除文本框并将下拉框放在asp.net中

And the value that is used before in textbox, now it should take from dropdown box

以及在文本框中使用的值,现在应该从下拉框中获取

2 个解决方案

#1


You can use select tag for this. And can get the selected value in C# using the following code

您可以使用select标签。并且可以使用以下代码在C#中获取所选值

Suppose cmb is the id of your dropdown box, then

假设cmb是你的下拉框的id

cmb.Items[ cmb.SelectedIndex ].Value

can fetch the value selected in your drop down box and

可以获取下拉框中选择的值

cmb.Items[ cmb.SelectedIndex ].Text

can fetch the text selected

可以获取所选的文本

#2


easiest way is to use jquery and jquery.jeditable plugin with it.

最简单的方法是使用jquery和jquery.jeditable插件。

#1


You can use select tag for this. And can get the selected value in C# using the following code

您可以使用select标签。并且可以使用以下代码在C#中获取所选值

Suppose cmb is the id of your dropdown box, then

假设cmb是你的下拉框的id

cmb.Items[ cmb.SelectedIndex ].Value

can fetch the value selected in your drop down box and

可以获取下拉框中选择的值

cmb.Items[ cmb.SelectedIndex ].Text

can fetch the text selected

可以获取所选的文本

#2


easiest way is to use jquery and jquery.jeditable plugin with it.

最简单的方法是使用jquery和jquery.jeditable插件。