Я пытаюсь реализовать загрузочную карусель и навигационную панель, используя главную страницу asp.net, но на страницах, которые я пытался реализовать, ничего не отображается

Код главной страницы

 <%@ Master Language="C#" AutoEventWireup="true" 
CodeBehind="Survey.master.cs" Inherits="SurveySystem.Survey" %>    
<!DOCTYPE html>

 <html>
 <head runat="server">
 <title></title>
 <asp:ContentPlaceHolder ID="head" runat="server">
 </asp:ContentPlaceHolder>
</head>
 <body>
<form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder ID="body" runat="server">
            <asp:Image ID="Image1" runat="server"  
      src="~/ProjectImage/download (2).jpg"/>
            </asp:ContentPlaceHolder>
      </div>
    </form>
 </body>
 </html>

Форма, на которой я пытался реализовать главную страницу

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SignUp.aspx.cs" 
Inherits="SurveySystem.SignUp" MasterPageFile="~/Survey.Master"  %>


   <asp:Content runat="server" ID="Content1" ContentPlaceHolderID="body" >

       <h3 align="center">
            Sign Up to Create Your Survey
        </h3>
        <table >

            <tr>
                <td class="auto-style1" colspan="2">
                    <asp:Label ID="Label1" runat="server" Text="First 
           Name*">
    </asp:Label>
                </td>
                <td class="auto-style2">
                    <asp:TextBox ID="TextBoxFirstName" runat="server" 
        placeholder="First Name" class="form-control"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style1" colspan="2">
                    <asp:Label  ID="Label2" runat="server" Text="Middle 
        Name"></asp:Label>
                </td>
                <td class="auto-style2">
                    <asp:TextBox class="form-control" ID="TextBoxMiddleName" 
     runat="server" placeholder="Middle Name"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style1" colspan="2">
                    <asp:Label ID="Label3"  runat="server" Text="Last Name">
     </asp:Label>
                </td>
                <td class="auto-style2">
                    <asp:TextBox ID="TextBoxLastName" class="form-control" 
     runat="server" placeholder="Last Name"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style1" colspan="2">
                    <asp:Label ID="Label5" runat="server"  Text="Email*">
      </asp:Label>
                </td>
                <td class="auto-style2">
                    <asp:TextBox ID="TextBoxEmail" runat="server" 
     class="form-control" placeholder="Email"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style1" colspan="2">
                    <asp:Label ID="Label4" runat="server" Text="Password*">
      </asp:Label>
                </td>
                <td class="auto-style2">
                    <asp:TextBox ID="TextBoxpassword" runat="server" 
      class="form-control" TextMode="Password" placeholder="Password">
    </asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style1" colspan="2">
                    <asp:Label ID="Label6" runat="server" Text="Confirm 
        Password*"></asp:Label>
                </td>
                <td class="auto-style2">
                    <asp:TextBox ID="TextBoxConfirm" TextMode="Password" 
      runat="server" class="form-control" placeholder="Confirm Password">
    </asp:TextBox>
                </td>
            </tr>

            <tr>
                <td colspan="2">

                    <asp:FileUpload ID="UserFileUploadImage" runat="server" 
       />

                </td>
                <td class="auto-style2">
                    <asp:Image ID="UserImagUpload" class="img-rounded" 
        runat="server" Width="150px" Height="150px" />
                </td>
            </tr>
            <tr>
                <td colspan="3" align="center">
                    <asp:Button ID="ButtonSignUp" runat="server" 
    Text="SignUp" OnClick="ButtonSignUp_Click" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    * Mendatory Fields (You Must Fill these Fields)
                </td>
            </tr>
        </table>




         </asp:Content>

Вот весь код, который я реализую, но он не показывает мне ничего о карусели Bootstrap и панели навигации.

0
Khaleeq Ur Rehman 1 Янв 2018 в 16:48

2 ответа

Лучший ответ

Вы поместили изображение в asp ContentPlaceHolder, что неверно. Как следует из названия, это просто заполнитель, и все, что вы хотите поместить в него, должно быть помещено в теги содержимого WebForms.

Ваш код должен выглядеть так:

Мастер

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Survey.master.cs" Inherits="SurveySystem.Survey" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:Image ID="Image1" runat="server" src="~/ProjectImage/download (2).jpg" />
            <asp:ContentPlaceHolder ID="body" runat="server">
                <%-- Dont write any code here --%>
            </asp:ContentPlaceHolder>
        </div>
    </form>
</body>
</html>

WebForms

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SignUp.aspx.cs" Inherits="SurveySystem.SignUp" MasterPageFile="~/Survey.Master" %>

<asp:Content runat="server" ID="Content2" ContentPlaceHolderID="head"></asp:Content>

<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="body">

    <h3 align="center">Sign Up to Create Your Survey
    </h3>
    <table>

        <tr>
            <td class="auto-style1" colspan="2">
                <asp:Label ID="Label1" runat="server" Text="First Name*"></asp:Label>
            </td>
            <td class="auto-style2">
                <asp:TextBox ID="TextBoxFirstName" runat="server" placeholder="First Name" class="form-control"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="auto-style1" colspan="2">
                <asp:Label ID="Label2" runat="server" Text="Middle Name"></asp:Label>
            </td>
            <td class="auto-style2">
                <asp:TextBox class="form-control" ID="TextBoxMiddleName" runat="server" placeholder="Middle Name"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="auto-style1" colspan="2">
                <asp:Label ID="Label3" runat="server" Text="Last Name"></asp:Label>
            </td>
            <td class="auto-style2">
                <asp:TextBox ID="TextBoxLastName" class="form-control" runat="server" placeholder="Last Name"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="auto-style1" colspan="2">
                <asp:Label ID="Label5" runat="server" Text="Email*"></asp:Label>
            </td>
            <td class="auto-style2">
                <asp:TextBox ID="TextBoxEmail" runat="server" class="form-control" placeholder="Email"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="auto-style1" colspan="2">
                <asp:Label ID="Label4" runat="server" Text="Password*"></asp:Label>
            </td>
            <td class="auto-style2">
                <asp:TextBox ID="TextBoxpassword" runat="server" class="form-control" TextMode="Password" placeholder="Password"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="auto-style1" colspan="2">
                <asp:Label ID="Label6" runat="server" Text="Confirm Password*"></asp:Label>
            </td>
            <td class="auto-style2">
                <asp:TextBox ID="TextBoxConfirm" TextMode="Password" runat="server" class="form-control" placeholder="Confirm Password"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td colspan="2">

                <asp:FileUpload ID="UserFileUploadImage" runat="server" />
            </td>
            <td class="auto-style2">
                <asp:Image ID="UserImagUpload" class="img-rounded" runat="server" Width="150px" Height="150px" />
            </td>
        </tr>
        <tr>
            <td colspan="3" align="center">
                <asp:Button ID="ButtonSignUp" runat="server" Text="SignUp" OnClick="ButtonSignUp_Click" />
            </td>
        </tr>
        <tr>
            <td colspan="2">* Mendatory Fields (You Must Fill these Fields)
            </td>
        </tr>
    </table>
</asp:Content>
0
zsubzwary 3 Янв 2018 в 00:53

Мастер :

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPageName.master.cs" Inherits="ApplicationName.MasterPageName" %>

....


<asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>

</head>

<body>
<form runat="server">
 <div class="row">
                        <div class="col-md-12">

                            <div>
                                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                                </asp:ContentPlaceHolder>
                            </div>

                        </div>
                    </div>
                    <!-- END PAGE CONTENT-->
                </div>
</form>
</body>

Страницы:

    <%@ Page Title="" Language="C#" MasterPageFile="~/MasterPageName.Master" AutoEventWireup="true" CodeBehind="PageName.aspx.cs" Inherits="ApplicationName.FolderExistsIFHave.PageName" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %>



<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>Blank Page</h1>
</asp:Content>
0
halfer 6 Янв 2018 в 23:26