|
Thanks to all for response
Unless u don't give ur hundred percent whatever u r doning till there is no result of ur work...
|
|
|
|
|
Hi,
I am currently wanted to include my master page into a page that do not include master page initially. I'd tried this code,
protected override void OnPreInit(EventArgs e)
{
this.MasterPageFile = "~/Main.master";
base.OnPreInit(e);
}
but run into this error
Content controls have to be top-level controls in a content page or a nested master page that references a master page
What I am trying to do is to include a master page into the web page during run time as I only wanted the master page to be included when certain criteria is met.
I'd look around the net but still don't get it what went wrong, hope I can get some idea from here.
Thanks.
|
|
|
|
|
Can you post here .aspx code ?
Please make sure, do not put any controls out side the Content place holder and set property runat server.
Parwej Ahamad
R & D with IIS 5.0/6.0
|
|
|
|
|
Here's the aspx page
<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeFile="E06-Employee.aspx.cs" Inherits="E04_Employee" %>]]>
<![CDATA[
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>E06-Employee</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:scriptmanager id="ScriptManager1" runat="server">
</asp:scriptmanager>
<asp:textbox id="txtCompId" runat="server" visible="False"></asp:textbox>
<cc1:tabcontainer id="TabContainer1" runat="server" activetabindex="0" font-names="Arial">
font-size="Small"><cc1:tabpanel runat="server" headertext="TabPanel1" id="TabPanel1"><contenttemplate>
<br /><asp:button id="btnNewEmp" runat="server" text="New Employee"></asp:button><br />
<asp:gridview id="GridView1" runat="server" font-names="Arial" font-size="Small" datakeynames="empId,lup_CompanycpyId" autogeneratecolumns="False" emptydatatext="There are no data records to display." datasourceid="SqlEmployee" allowpaging="True" allowsorting="True" pagesize="20" width="753px" backcolor="White" bordercolor="#E7E7FF" borderstyle="None" borderwidth="1px" cellpadding="3" gridlines="Horizontal" onrowdatabound="GridView1_RowDataBound">
<footerstyle backcolor="#B5C7DE" forecolor="#4A3C8C"></footerstyle>
<columns>
<asp:boundfield readonly="True" datafield="empId" visible="False" sortexpression="empId" headertext="empId"></asp:boundfield>
<asp:hyperlinkfield datanavigateurlfields="empId,lup_CompanycpyId" datanavigateurlformatstring="~/E0601-NewEmployee.aspx?empid={0}&compid={1}&update=1">
DataTextField="empName" HeaderText="Name" NavigateUrl="~/E0601-NewEmployee.aspx?empid={0}&update=1&compid={1}&option=employee"
SortExpression="empName" Target="_blank" />
<asp:boundfield datafield="empEmpNo" sortexpression="empEmpNo" headertext="Employee No."></asp:boundfield>
<asp:boundfield datafield="empEmail" visible="False" sortexpression="empEmail" headertext="empEmail"></asp:boundfield>
<asp:boundfield datafield="empPwd" visible="False" sortexpression="empPwd" headertext="empPwd"></asp:boundfield>
<asp:boundfield datafield="empJoinDt" visible="False" sortexpression="empJoinDt" headertext="empJoinDt"></asp:boundfield>
<asp:boundfield datafield="empLeaveDt" visible="False" sortexpression="empLeaveDt" headertext="empLeaveDt"></asp:boundfield>
<asp:boundfield datafield="empRpt1" visible="False" sortexpression="empRpt1" headertext="empRpt1"></asp:boundfield>
<asp:boundfield datafield="empRpt2" visible="False" sortexpression="empRpt2" headertext="empRpt2"></asp:boundfield>
<asp:checkboxfield datafield="empStat" sortexpression="empStat" headertext="Active/Inactive"></asp:checkboxfield>
<asp:boundfield datafield="empTitle" sortexpression="empTitle" headertext="Title"></asp:boundfield>
<asp:boundfield datafield="empUrl" visible="False" sortexpression="empUrl" headertext="empUrl"></asp:boundfield>
<asp:templatefield headertext="Department" sortexpression="lup_DeptdptId">
<edititemtemplate>
<asp:textbox id="TextBox1" runat="server" text=""><![CDATA['></asp:textbox>
</edititemtemplate>
<itemtemplate>
<asp:label id="Label1" runat="server" text=""><![CDATA[' Visible="False"></asp:label>
<asp:label id="lblDept" runat="server"></asp:label>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Status" sortexpression="lup_StaffStatsstId">
<edititemtemplate>
<asp:textbox id="TextBox2" runat="server" text=""><![CDATA['></asp:textbox>
</edititemtemplate>
<itemtemplate>
<asp:label id="Label2" runat="server" text=""><![CDATA[' Visible="False"></asp:label>
<asp:label id="lblStat" runat="server"></asp:label>
</itemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Leave Group" sortexpression="lup_SalaryGrpsgpId">
<edititemtemplate>
<asp:textbox id="TextBox3" runat="server" text=""><![CDATA['></asp:textbox>
</edititemtemplate>
<itemtemplate>
<asp:label id="Label3" runat="server" text=""><![CDATA[' Visible="False"></asp:label>
<asp:label id="lblLeaveGrp" runat="server"></asp:label>
</itemtemplate>
</asp:templatefield>
<asp:boundfield datafield="lup_CompanycpyId" visible="False" sortexpression="lup_CompanycpyId" headertext="lup_CompanycpyId"></asp:boundfield>
<asp:boundfield datafield="lup_ApproveTypeapvId" visible="False" sortexpression="lup_ApproveTypeapvId" headertext="lup_ApproveTypeapvId"></asp:boundfield>
<asp:templatefield showheader="False">
<itemtemplate>
<asp:linkbutton id="LinkButton1" runat="server" causesvalidation="False" commandname="Delete">
Text="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this record?');"></asp:linkbutton>
</itemtemplate>
</asp:templatefield>
</asp:hyperlinkfield></columns>
<rowstyle backcolor="#E7E7FF" forecolor="#4A3C8C"></rowstyle>
<selectedrowstyle backcolor="#738A9C" forecolor="#F7F7F7" font-bold="True"></selectedrowstyle>
<pagerstyle backcolor="#E7E7FF" forecolor="#4A3C8C" horizontalalign="Right"></pagerstyle>
<headerstyle backcolor="#4A3C8C" forecolor="#F7F7F7" font-bold="True" horizontalalign="Left"></headerstyle>
<alternatingrowstyle backcolor="#F7F7F7"></alternatingrowstyle>
</asp:gridview>
</contenttemplate>
<headertemplate>
Employee List
</headertemplate>
</cc1:tabpanel>
</cc1:tabcontainer>
<asp:button id="btnBack" runat="server" text="Back" />
<asp:button id="btnDone" runat="server" text="Done" onclick="btnDone_Click" width="98px" /><br />
<asp:sqldatasource id="SqlEmployee" runat="server" connectionstring=""><![CDATA["
DeleteCommand="DELETE FROM [emp_Employee] WHERE [empId] = @empId" InsertCommand="INSERT INTO [emp_Employee] ([empId], [empName], [empEmail], [empPwd], [empEmpNo], [empJoinDt], [empLeaveDt], [empRpt1], [empRpt2], [empStat], [empTitle], [empUrl], [lup_DeptdptId], [lup_StaffStatsstId], [lup_SalaryGrpsgpId], [lup_CompanycpyId], [lup_ApproveTypeapvId]) VALUES (@empId, @empName, @empEmail, @empPwd, @empEmpNo, @empJoinDt, @empLeaveDt, @empRpt1, @empRpt2, @empStat, @empTitle, @empUrl, @lup_DeptdptId, @lup_StaffStatsstId, @lup_SalaryGrpsgpId, @lup_CompanycpyId, @lup_ApproveTypeapvId)"
ProviderName="<%$ ConnectionStrings:connString.ProviderName %>" SelectCommand="E06GetEmployee"
UpdateCommand="UPDATE [emp_Employee] SET [empName] = @empName, [empEmail] = @empEmail, [empPwd] = @empPwd, [empEmpNo] = @empEmpNo, [empJoinDt] = @empJoinDt, [empLeaveDt] = @empLeaveDt, [empRpt1] = @empRpt1, [empRpt2] = @empRpt2, [empStat] = @empStat, [empTitle] = @empTitle, [empUrl] = @empUrl, [lup_DeptdptId] = @lup_DeptdptId, [lup_StaffStatsstId] = @lup_StaffStatsstId, [lup_SalaryGrpsgpId] = @lup_SalaryGrpsgpId, [lup_CompanycpyId] = @lup_CompanycpyId, [lup_ApproveTypeapvId] = @lup_ApproveTypeapvId WHERE [empId] = @empId" SelectCommandType="StoredProcedure">
<insertparameters>
<asp:parameter name="empId" type="Int32" />
<asp:parameter name="empName" type="String" />
<asp:parameter name="empEmail" type="String" />
<asp:parameter name="empPwd" type="String" />
<asp:parameter name="empEmpNo" type="String" />
<asp:parameter name="empJoinDt" type="DateTime" />
<asp:parameter name="empLeaveDt" type="DateTime" />
<asp:parameter name="empRpt1" type="Int32" />
<asp:parameter name="empRpt2" type="Int32" />
<asp:parameter name="empStat" type="Boolean" />
<asp:parameter name="empTitle" type="String" />
<asp:parameter name="empUrl" type="String" />
<asp:parameter name="lup_DeptdptId" type="Int32" />
<asp:parameter name="lup_StaffStatsstId" type="Int32" />
<asp:parameter name="lup_SalaryGrpsgpId" type="Int32" />
<asp:parameter name="lup_CompanycpyId" type="Int32" />
<asp:parameter name="lup_ApproveTypeapvId" type="Int32" />
</insertparameters>
<updateparameters>
<asp:parameter name="empName" type="String" />
<asp:parameter name="empEmail" type="String" />
<asp:parameter name="empPwd" type="String" />
<asp:parameter name="empEmpNo" type="String" />
<asp:parameter name="empJoinDt" type="DateTime" />
<asp:parameter name="empLeaveDt" type="DateTime" />
<asp:parameter name="empRpt1" type="Int32" />
<asp:parameter name="empRpt2" type="Int32" />
<asp:parameter name="empStat" type="Boolean" />
<asp:parameter name="empTitle" type="String" />
<asp:parameter name="empUrl" type="String" />
<asp:parameter name="lup_DeptdptId" type="Int32" />
<asp:parameter name="lup_StaffStatsstId" type="Int32" />
<asp:parameter name="lup_SalaryGrpsgpId" type="Int32" />
<asp:parameter name="lup_CompanycpyId" type="Int32" />
<asp:parameter name="lup_ApproveTypeapvId" type="Int32" />
<asp:parameter name="empId" type="Int32" />
</updateparameters>
<deleteparameters>
<asp:parameter name="empId" type="Int32" />
</deleteparameters>
<selectparameters>
<asp:controlparameter controlid="txtCompId" name="lup_CompanycpyId" propertyname="Text">
Type="Int32" />
</asp:controlparameter></selectparameters>
</asp:sqldatasource>
</div>
</form>
</body>
</html>
|
|
|
|
|
Looks like you have some text or control placed outside asp:content tag. When you use master pages, make sure your controls and all other texts in the content page are inside the asp:content tag.
|
|
|
|
|
Ya, I read this about asp:content tag, but what I don't understand is I could not find asp:content tag in any of my page. Sorry this might sound silly, where should this asp:content tag suppose to be in? .master or .aspx?
|
|
|
|
|
It should be in a content page, not in master page.
I got your problem, you are trying to change a master page dynamically in a page where master page is not at all used. Try putting your ASPX page contents into
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content> . Master page should contain body, form and a content placeholder. In your content page, supply the content placeholder id to asp:content's ContentPlaceHolderID property.
Hope this helps
|
|
|
|
|
I think it wont help, if master page is not referenced when he wants it not to contain one, then it will throw error again, coz of using content control without a master page.
I dont have a solution now, gotta check that out, if i get ill let ya know..
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
I think I slowly get what you mean. The content page is where all my textboxes, buttons are.
This is what I did, in my aspx page's html:
<asp:content id="Content1" contentplaceholderid="ContentPlaceHolder1" runat="Server">
<body>
</body>
</asp:content>
But I got the error when change it back to design view
Content control can only be use in a content page
I guess I still missing some point you trying to tell me?
|
|
|
|
|
Let me throw some light here...
If you are using a master page, the contents you are using for a page must be inside the content template as you mentioned in the post..
However, you could only have a master page on a page or you dont have one.. and as you cant change the aspx design page at runtime, it is bound to throw an error...
I suggest you use two different pages, one with master page and another without it, so that you could use them according to the situations you have..
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Oh ok, now I know that I can't include the master page during run time. Thanks for saving from turning in circle again and again.
|
|
|
|
|
Hi all,
I am generating some Excel files on the server as part of some reports generation process (I'm using the Apache POI library with IKVM). I am interested in printing them at once without involving the client-side and without having MS Excel installed on the server machine.
Is there any way to do this under the given conditions?
I would be interested even in some .NET library capable of doing this...
Thanks in advance!
Andrei
------------
Croitoriu Andrei
andrei.croitoriu@gmail.com
http://www.stud.usv.ro/~acroitoriu
http://spaces.msn.com/acroitoriu/
"No complexity beyond what is necessary"
|
|
|
|
|
Hi ,
I am having a tree view control.I want to change the css class (Background color) of the selected node of the tree view . I tried like this
<selectednodestyle cssclass="ClassName" font-underline="false" horizontalpadding="0px" verticalpadding="0px" forecolor="#5555DD">
But this is not working . Any solutions .
Thanks in advance
Jophin
jophin
|
|
|
|
|
check this out:
http://fredrik.nsquared2.com/viewpost.aspx?PostID=299
We are not a Code Charity
|
|
|
|
|
i am using .net2005 i want to fill events in dropdownlist by clicking particular date in calendar
modified on Monday, June 9, 2008 3:41 AM
|
|
|
|
|
You need an onclick event for the calendar and in there populate the dropdownlist
We are not a Code Charity
|
|
|
|
|
I have an asp.net webapplication which will send mail. The mail will be containing link to the same web application, when user click on the link it should open the same web application. But it is opening blank page. It is configured in the local intranet.
The link is something like this.. http://localhost/appname
How to solve this problem..
Please any one find me the answr as soon as possible
thanks
Jiss
|
|
|
|
|
Is the e-mail being opened from the same machine where the application is located?
If it isnt you wont be able to open the link
We are not a Code Charity
|
|
|
|
|
People will be using outlook express or microsoft outlook to check there internal mails in the organization. From there only that link should open the corresponding web application in new internet explorer window.
I am using mail sending code and embeding the url as
http://domainname/virtualdirname
but when i click onto link in mail it opens blank page.
please provide me with the proper solution
thanks in advance
shamshuddin
|
|
|
|
|
Easy way is to keep the domain name in some configuration file. Read from that configuration file while you send email. When you upload website to server, change this value to a valid one.
|
|
|
|
|
I didn't get this explanation. will you please explain. I detailed my problem down,
People will be using outlook express or microsoft outlook to check there internal mails in the organization. From there only that link should open the corresponding web application in new internet explorer window.
I am using mail sending code and embeding the url as
http://domainname/virtualdirname
but when i click onto link in mail it opens blank page.
please provide me with the proper solution
thanks in advance
shamshuddin
|
|
|
|
|
try giving the system name in place of localhost, that will work irrespective of where the set up is installed...
whereas localhost will only work on your system..
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Its not a web setup program. We configuered it under IIS just by coping the folder. I detailed my problem as follows. I tried by giving name also but it doesn't work.
People will be using outlook express or microsoft outlook to check there internal mails in the organization. From there only that link should open the corresponding web application in new internet explorer window.
I am using mail sending code and embeding the url as
http://domainname/virtualdirname
but when i click onto link in mail it opens blank page.
please provide me with the proper solution
thanks in advance
shamshuddin
|
|
|
|
|
meetshums wrote: People will be using outlook express or microsoft outlook to check there internal mails in the organization. From there only that link should open the corresponding web application in new internet explorer window.
Whatever they use for opening you're link, it'll open up..
meetshums wrote: I am using mail sending code and embeding the url as
http://domainname/virtualdirname
Are you not providing a page name where this should redirect??
If not it will obviously open a blank page if youve not configured the iis for a default page..
Try giving the page name as the default in iis documents tab..
Or in the link directly provide the page name
something like this ...
http://domainname/virtualdirname/pagename.aspx
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Hi all,
I am building on community portal where I want to show members family tree.
The look should be totally as tree.
I have all relation database.
I thinking that xml and flash would be useful for this but not shure.
so if anyone worked for same before or have knowledge pls help me
Thanks in advance
|
|
|
|