Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i wan to use an usercontrol (aspx) in a masterpage (in content pages) bu i can't. is there any sample to explain how to solve my problem.

What I have tried:

usercontrol (aspx) in a masterpage (in content pages)
Posted
Updated 17-Mar-16 9:55am
Comments
AnvilRanger 17-Mar-16 15:50pm    
First an UserControl does not have an extension of aspx, that is a WebForm. The extension for UserControls are ascx.

And why can you not place the UserControl in your master page? What problem are you facing? What errors are you getting? What are you expecting?
incobilgisayar 17-Mar-16 16:16pm    
Sir, have u any working sample!. normaly i do the same but there is mistake that not working
incobilgisayar 17-Mar-16 16:24pm    
yes i wrote down wrongly "aspx" in fact i try to do a usercontrol (ascx) when u decide to delete a records (after pressing delete button) that popup form going to come on you and ask a password (u goingto write down in a textbox) and then that data( password) transfer to mainform.
AnvilRanger 17-Mar-16 21:25pm    
You are going to need to go into more detail about the issues you are having. Update your question with code and as much info as you can.

1 solution

What issues are you facing? I can just Register the UC like normal and add the tag in the code for the master page.

ASP.NET
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="Master_MasterPage" %>
<%@ Register Src="~/UserControls/EmployeeSearch.ascx" TagPrefix="uc1" TagName="EmployeeSearch" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <uc1:EmployeeSearch runat="server" ID="ucEmployeeSearch" />
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
        
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900