简体   繁体   中英

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
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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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