创建新的文本框控件,自动完成属性asp.net c# [英] create new textbox control with autocomplete to the attribute asp.net c#

查看:84
本文介绍了创建新的文本框控件,自动完成属性asp.net c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在asp.net c#代码中创建一个文本框作为usercontrol。



添加一些特定功能:



我使用此代码进行.ascx控制:



  public  TextBoxType类型{ set ;  get ; } 

public enum TextBoxType
{
< span class =code-sdkkeyword> String = 0
Email = 1
密码= 2
MultiLine = 3
Numbers = 4
Link = 5
Decimal = 6
}





并添加此控件我正在使用此:



< BS:TextBox runat =   server /> 





每件事都运转正常,但问题在于自动完成属性



< BS:TextBox runat =   server 类型=   /> 


类型属性中的


我需要为枚举中的值自动完成:

电子邮件 - 密码....





我该怎么办?

解决方案

请参阅:

https:// msdn .microsoft.com / zh-cn / library / system.web.ui.webcontrols.textbox.autocompletetype% 28v = vs.110%29.aspx [ ^ ](你会在文章末尾找到一些代码示例。)



参见:

http://www.aspsnippets.com/Articles/AJAX-AutoCompleteExtender-Example-in-ASPNet.aspx [< a href =http://www.aspsnippets.com/Articles/AJAX-AutoCompleteExtender-Example-in-ASPNet.aspx\"target =_ blanktitle =New Window> ^ ],
http:// dotnetcodepress .com / Articles / ASP-dot-net / jquery-ui-autocomplete-textbox-from-database-in-asp-net [ ^ ],

< a href =http://dotnetcodepress.com/Articles/ASP-dot-net/jquery-ui-autocomplete-textbox-from-database-in-asp-net> http://dotnetcodepress.com/Articles/ASP -dot网/ jQuery的UI-AU tocomplete-textbox-from-database-in-asp-net [ ^ ]。



-SA

I am trying to create a textbox as usercontrol in asp.net c# code behind.

to add some specific feature :

I am using this code for .ascx control :

public TextBoxType Type { set; get; }

    public enum TextBoxType
    {
        String =0,
        Email=1,
        Password=2,
        MultiLine=3,
        Numbers=4,
        Link=5,
        Decimal=6,
    }



and to add this control I am using this :

<BS:TextBox  runat="server" />



every thing works fine but the problem is with the auto complete of the attribute

<BS:TextBox  runat="server" Type=""/>



in the Type attribute I need an auto complete for the values in the enum :
Email - Password ....


How can I do it ?

解决方案

Please see:
https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.autocompletetype%28v=vs.110%29.aspx[^] (you will find some code sample at the end of the article).

See also:
http://www.aspsnippets.com/Articles/AJAX-AutoCompleteExtender-Example-in-ASPNet.aspx[^],
http://dotnetcodepress.com/Articles/ASP-dot-net/jquery-ui-autocomplete-textbox-from-database-in-asp-net[^],
http://dotnetcodepress.com/Articles/ASP-dot-net/jquery-ui-autocomplete-textbox-from-database-in-asp-net[^].

—SA


这篇关于创建新的文本框控件,自动完成属性asp.net c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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