Adding a new property to a textbox

D

Dave

I'm new to asp.net and here's what I'm hoping to do. I want to create a control that uses the textbox control (inherits from?) and adds a new property called "Audit" to it. I then want to use this new textbox on a new webpage and be able to set the Audit property

Can someone point me to an example

Thanks
dave
 
S

Sarmad Aljazrawi

here is the code.

If Page.IsPostBack Then

' This would retrieve the property value when the form is
postback
TextBox2.Text = TextBox1.Attributes.Item("Audit")

End If

' This would add the audit property to the textbox
TextBox1.Attributes.Clear()
TextBox1.Attributes.Add("Audit", "1")

Dim myHttpResponse As HttpResponse = Response
Dim myHTMLTextWriter As New HtmlTextWriter(myHttpResponse.Output)

' This is to write the property to the html tag
TextBox1.Attributes.AddAttributes(myHTMLTextWriter)


i've tried this and it worked. hope this would solve your problem.

Regards
--
Sarmad Aljazrawi
B.Sc. Computer Science, MSDBA, MCP
www.aljazrawi.net


Dave said:
I'm new to asp.net and here's what I'm hoping to do. I want to create a
control that uses the textbox control (inherits from?) and adds a new
property called "Audit" to it. I then want to use this new textbox on a new
webpage and be able to set the Audit property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,787
Messages
2,569,630
Members
45,334
Latest member
66Zeinab9

Latest Threads

Top