简体   繁体   English

文本框在Asp.net中不显示文本

[英]Text box not Displaying Text in Asp.net

I'm Trying to use Shared Function to Display Output in TextBox, but when it is not displaying text, during Debug it shows that it has holding text , but i dont know why it is not showing text on Output 我正在尝试使用共享函数在TextBox中显示输出,但是当它不显示文本时,在Debug期间它表明它具有保持文本,但是我不知道为什么它不在输出中显示文本
Here is it small code 这是小代码

friend shared withevents wslisten As Winsock_Orcas.Winsock      
protected sub page_Load()           
    session("me") =Me              
    Test2()          
end sub            

Protected Shared Sub TestClass(byval current as _Default)  
    current.TextBox2.Text = "BHB"   
End Sub         

Friend Shared Sub dataarrive( byval sender as object, byval e as winsock_orcas.winsockdataarrivaleventargs) handles wslisten.dataarival   
    TestClass(Session("me"))               
end sub 

It's because the control you created is not rendered in HTML / Not added in your form at runtime. 这是因为您创建的控件没有以HTML呈现,也没有在运行时添加到表单中。 As per your code, you are using the Textbox which is in your designer already. 根据您的代码,您正在使用设计器中已经存在的文本框。 For that you can use below mentioned code.. 为此,您可以使用下面提到的代码。

Protected Shared Sub TestClass(ByVal currentPage As _Default)
    currentPage.TextBox2.Text = "BHB"
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   TestClass(Me)
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM