In the previous article, I demonstrated how to create you own WYSIWYG. Now that you know how to create your own, let me show you how to implement one that I have created.
(2)
For this demonstration you will need to download the code by using the link at the top of this page. Once you have downloaded the code, extract the files to the root of your application. If you have no other web sites setup, extract the files to C:\Inetpub\wwwroot or where ever your wwwroot folder is located. Once the files are extracted you should have a bin folder, an img folder, a webservice folder, and a TextEditor help file. If you browse into the webservice folder, you should find a file called texteditor.asmx. If you browse into the bin folder, you will find a file called TextEditor.dll. The img folder contains the WYSIWYG images.
Now that the files are downloaded, we can begin. Open up your web editor again. We are also going to open up a browser. In the browser, go to {Your Web}/webservice/texteditor.asmx. You should see an imag similar to the following:

Click on the web method that reads WriteEditor. Your screen should look like this:

Then, enter in values of 1 for all items except for width (enter 500) and height (enter 300).

Finally, click invoke to get the results. The results will open in another window in XML format like this:

Copy the results (the black text) in between the <string> tags. Paste the results into your web editor. Save the file in your web root as texteditor1.htm. Go to your browser and navigate to http://{Your Web}/texteditor1.htm. You should have a page that looks like this:

Now that you know how the web service works, you can either create a *.dll from the web service on your local web, or use the *.dll file from the bin directory in your local web. You will call the *.dll in your web page by doing the following:
1: <%@ Page Language="vb" %> 2: 3: <script runat="server"> 4: 5: Sub Page_Load(s as Object, e as EventArgs) 6: Dim myEditor as New TextEditor() 7: Dim writeMe as String = myEditor.WriteEditor(1,1,1,1,1,1,1,1,1,1,1,1,400,300) 8: 9: Dim myHeader as String = "<html><head><title>Testing TextEditor </title></head><body>" 10: Dim myFooter as String = "</body></html>" 11: 12: writeMe = myHeader & writeMe & myFooter 13: 14: Response.Write(writeMe) 15: End Sub 16: 17: </script>
Use the following link as a reference for the passed parameters:http://www.ASPAlliance.com/jgaylord/services/texteditor/help.aspx
[My Column]
[Printer-Friendly]
[Part 1]
|