1

Is there any way to add CSS template for existing webform that has no CSS template added?

My code is listed below, any guidance about how to add CSS template for the form that already exists in the site master will be greatly appreciated:

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="Linkchecker.WebForm2"
    ValidateRequest="false" EnableViewState="false" EnableViewStateMac="false" EnableSessionState="True"
    EnableEventValidation="false" ViewStateEncryptionMode="Never" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript">
        function finda() {
            var a = document.getElementsByTagName("a");
            var b = document.getElementById("TextBox1");
            b.value = "";


                        for (var i = 0; i < a.length; i++) {
                            a[i] = a.length.value;


                            if (a[i] == null) {
                                alert("Their is no links");
                            }   
                            else {
                                b.value = b.value + "\r\n\n" + a[i]  ;
                            }

                        }

                        //            window.open("http://www.fillsim.com");
                        window.close();
                     //   window.open("WebForm3.aspx?req=" + b.value);


        }
    </script>
     <script>
         var howLong = 6000;
         t = null;
         function closeMe() {
             t = setTimeout("self.close()", howLong);
         }
   </script>
      <script type = "text/javascript">


     var defaultText = "http://www.example.com";
           function waterMarkText(txt, evt) {
               if (txt.value.length == 0 && evt.type == "blur") {
                   txt.style.color = "red";
                   txt.value = defaultText;
               }
               if (txt.value == defaultText && evt.type == "focus") {
                   txt.style.color = "green";
                   txt.value = "";
               }
       }
</script>

</head>
<body >

    <form id="form1" runat="server">
    Enter the URL:<br />
    <asp:TextBox ID="urltxt" runat="server" Width="402px" Text="http://www.example.com" ForeColor="Gray" onblur = "waterMarkText(this, event);" onfocus = "waterMarkText(this, event);"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="btnRender" runat="server" Text="Page Render" OnClick="btnRender_Click" />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="btn_submit" runat="server" Text="Submit" OnClientClick="javascript:finda();" />
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="btn_createlink" runat="server"
        Text="Create link" OnClick="btn_createlink_Click" />
    &nbsp;&nbsp;&nbsp;
    <br />
    <br />
    <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="373px" Width="410px"></asp:TextBox>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="TextBox2" runat="server" Height="371px" TextMode="MultiLine" Width="409px"></asp:TextBox>
    &nbsp;<div class="ab" id="div" runat="server">
        <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Clear" 
            Width="71px" />
    </div>
    </form>


</body>
</html>
j0k
  • 22,600
  • 28
  • 79
  • 90
hitarth
  • 317
  • 4
  • 5
  • 19

1 Answers1

0

You can add in your <head runat="server"> section

<link href="Styles/Site.css" rel="stylesheet" type="text/css" />
<style type="text/css">
   .product-bottom-container 
   {
        width: 100%;
        overflow: hidden;
        height: 10px;
        border-top: 1px solid #C41212;            
        background-color: #ECECEC;

   }
</script>

Combinding it

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="Linkchecker.WebForm2"
    ValidateRequest="false" EnableViewState="false" EnableViewStateMac="false" EnableSessionState="True"
    EnableEventValidation="false" ViewStateEncryptionMode="Never" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
        <link href="Styles/Site.css" rel="stylesheet" type="text/css" />

Edit 1

Here is a link how to add master page in an existing page
How to assign a master page to a existing .aspx page?

Community
  • 1
  • 1
शेखर
  • 17,412
  • 13
  • 61
  • 117
  • i have already copy all those css tag links from site master to webform2 which is not having template i forget to add master page in webform2 but now how can i do @shekhar but thanks done this before but all my design content of webform2 gets destroy – hitarth Feb 28 '13 at 09:11
  • then it says content not found and if i deleted   – hitarth Feb 28 '13 at 09:16
  •   what about this? if i delted then error gots clear but says content not found and if i add then error occurs what to do? – hitarth Feb 28 '13 at 09:19
  • what do you exactly want? Want to apply master page on existing page? – शेखर Feb 28 '13 at 09:27
  • hey shekhar but my content of webform are gone and if add the content of master page then it gives error – hitarth Feb 28 '13 at 09:45