Tuesday, July 28, 2009

In c#.net with asp.net how to set the color,alignment,bullets in textbox at runtime?

If you are trying to set the color at runtime, it can be done by assigning it in the pageload method. To do this, simply add this.TextBox1.BackColor=Color.Black; to the PageLoad Method. To set the allignment, an ASP textbox control doesn't have this in the code behind, but I believe you can use TextBox1.Attributes["align"]="right"; If that doesn't work then use an HTML text box and add the attribute -%26gt; runat="server" to the HTML where it is implemented. Then use the code behind to modify that as shown above.





Finally, I've never used bullets in a textbox, so just search google for that and if there is a way, you can find it there.


Good luck!

In c#.net with asp.net how to set the color,alignment,bullets in textbox at runtime?
Use the Page_Load or OnPreRender events.





If you are using Visual Studio then the Intellisense will tell you what properties a textbox has.
Reply:All above is presentation and not logic.





So, I strongly suggest to use CSS to set those attributes:





- give ID to TextBox control


- use that ID as reference in CSS file to set attributes





If runtime action is needed (change of those params to something else), use javascript:





- locate control by ID given using DOM (Document Object Model)


- use attributes of object in your javascript code to change them


No comments:

Post a Comment