如何在asp.net的下拉列表框中编辑 [英] how to edit in my dropdownlist box in asp.net

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

问题描述

我想像textbox一样编辑我的下拉列表框。我已经多次尝试过了。但我不能。

我不想使用ajax工具。

有没有办法可以帮助我在编辑模式下改变我的默认下拉列表框。 br />
请帮帮我。在此先感谢。

I want to edit my dropdownlist box like textbox. I have tried it many times. But I couldn't.
I don't want to use ajax tool.
Is there any way that help me to alter my default dropdownlist box in edit mode.
Please help me. Thanks in advance.

推荐答案

请参阅我的评论。



首先,您应该了解如何ASP.NET在Web应用程序中工作。没有诸如下拉列表或文本框之类的HTML元素。 ASP.NET代码在服务器端工作,并生成纯正常的HTML内容,没有所有那些ASP.NET Wen控件。特别是,用户可以输入某些文本的唯一控制元素是< input type =text> < textarea> 元素,两者都由ASP.NET TextBox 控件表示。这就是你可以用来编辑的全部内容。



现在,由你来设计代码可以提供这样的输入元素给用户。原则上,您甚至可以模拟列表元素的就地编辑,但这不会那么简单。当用户编辑文本并按Enter键或单击某个按钮或其他控件意味着将编辑后的文本提交到下拉列表时,您应该编写一些JavaScript来更新,例如,要编辑的列表中的选定项目。 />


这是你的工作。如果您尝试设计和实施类似的东西并遇到一些特殊困难,您可以清楚地解释,欢迎您提出您的问题;我们很乐意帮助您。



-SA
Please see my comment.

First of all, you should understand how ASP.NET works in a Web application. There are no such HTML elements as "drop-down list" or "text box". ASP.NET code works on the server side and generate pure normal HTML content, without all those ASP.NET Wen controls. In particular, the only control elements where a user can enter some text would be <input type="text"> or <textarea> elements, both are represented by the ASP.NET TextBox control. This is all you can use for editing.

Now, it's up to you to design the code which would present such input element to the user. In principle, you can even mimic in-place editing of a list element, but it would not so simple. When a user edits the text and hit Enter or clicks some button or other control meaning committing the edited text to the drop-down list, you should write some JavaScript to update, say, the selected item of a list to be edited.

This is your job to do. If you try to design and implement something like that and have some particular difficulties you can clearly explain, you are welcome to ask your questions; we will gladly try to help you.

—SA


您可以查看这些文章CP:

自定义ASP.NET可编辑DropDownList [ ^ ]

Dropdown TextBox [ ^ ]

然后也按照:

< a href =http://stackoverflow.com/questions/10926977/editable-dropdown-in-asp-net> Editable-dropdown-in-asp-net [ ^ ]

可能 - 创建 - 可编辑 - 下拉列表 - 使用 - asp-net [ ^ ]
You can check these articles of CP:
Custom ASP.NET Editable DropDownList[^]
Dropdown TextBox[^]
And then also follow:
Editable-dropdown-in-asp-net[^]
Possible-create-editable-drop-down-list-using-asp-net[^]


这篇关于如何在asp.net的下拉列表框中编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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