ASP.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a ASP.NET Expert!

Join 309,258 ASP.NET Programmers for FREE! Get instant access to thousands of ASP.NET experts, tutorials, code snippets, and more! There are 2,489 people online right now. Registration is fast and FREE... Join Now!




Response.Write with XHTML Compliant Code

 

Response.Write with XHTML Compliant Code

wolf11228

30 Jun, 2009 - 07:33 AM
Post #1

New D.I.C Head
*

Joined: 13 Dec, 2008
Posts: 7

I am working on a ASP.NET website that will dynamically change the size of a video. I know that this is not very clean code, but it doesn't need much optimization for its future use. What I'd like know is if there is a way to write XHTML compliant code in the Response.Write(). See below in the function videoPlay, I had to remove all quotation marks to compile without errors. Thanks for any help!

Mike

CODE

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    void videoPlay(object sender, EventArgs e)
    {
        string w = Convert.ToString(wth.Text);
        string h = Convert.ToString(ht.Text);
        int w_compare = Convert.ToInt32(wth.Text);
        int h_compare = Convert.ToInt32(ht.Text);

        if ((w_compare < 100) || (h_compare < 100))
        {
            Response.Write("<h1> Video Size of (" + w + "x" + h + ")px is too small</h1>");
        }
        else
        {
            Response.Write("<table border=0 cellpadding=3>");
            Response.Write("<tr>");
            Response.Write("<embed src=test.rpm width=" + w + " height=" + h + "nojava=true controls=ImageWindow console=one /> </tr>");
            Response.Write("<tr><embed src=test.rpm width=" + w + " height=27 nojava=true controls=ControlPanel console=one /></tr>");
            Response.Write("</table><br />");
            
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Testing video</title>
</head>
<body>
    <form id="video" runat="server" >
        <table border="0" cellpadding="3" >
        <tr>
            <td>Width</td>
            <td>Height</td>
        </tr>
        <tr>
            <td><asp:TextBox ID="wth" Columns="10" runat="server" Text="320" MaxLength="4" />px</td>
            <td><asp:TextBox ID="ht" Columns="10" runat="server" Text="480" MaxLength="4" />px</td>
            <td><asp:Button ID="Button1" Text="Submit" OnClick="videoPlay" runat="server" /></td>
        </tr>
        </table>
    </form>
</body>
</html>


User is offlineProfile CardPM
+Quote Post


Wimpy

RE: Response.Write With XHTML Compliant Code

30 Jun, 2009 - 10:15 AM
Post #2

I feel happy... *singing*
Group Icon

Joined: 2 May, 2009
Posts: 958



Thanked: 132 times
Dream Kudos: 75
My Contributions
You have to escape the quotation marks:
CODE

Response.Write("<table border=\"0\" cellpadding=\"3\">");


smile.gif


User is offlineProfile CardPM
+Quote Post

wolf11228

RE: Response.Write With XHTML Compliant Code

30 Jun, 2009 - 03:02 PM
Post #3

New D.I.C Head
*

Joined: 13 Dec, 2008
Posts: 7

Thank you very much! Seems like the most simple things are hard to find with google. Appreciate it!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/26/09 09:58AM

Live ASP.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

ASP.NET Tutorials

Reference Sheets

ASP.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month