Reputation: 8295
I am creating a program that allows users to create there own stylesheets and save them. What i want to know, is it possible to load the stylesheet back into the program and display its contents in a textbox. I only need to know how to display its contents.
Thanks to all who look
Upvotes: 0
Views: 67
Reputation: 29186
...load the stylesheet back into the program and display its contents in a textbox.
The basic logic is:
txtCss.Text = File.ReadAllText("Path to CSS file")
Regards how you set the path, you can either use a physical path eg
"C:\CssFiles\Files1.css"
Or you could use a virtual path in your site using Server.MapPath eg
string filePath = Server.MapPath("~/files/css/file1.css")
Upvotes: 2
Reputation: 63970
Yes, it's possible. If you provide an textfield element on your page where the user defines his stylesheet, you can simply take the text in the texfield when the page posts back and save it on the server side and do whatever you need to it.
If the stylesheet is created outside your web page, you can simply provide a way for the user to upload it via the FileUpload control
Upvotes: 1