siddiqishahid
asked on
Having problem using MasterPage in ASP.Net
I have inherited MasterPage in one of asp.net form. I have added some controls in Content box but when I click on Source, I do not see element such as <html>, <head>, <body> and <form> etc..
From this web form, I call another ASP.Net popup form to pick date from calendar and selected date does not transfer to calling form. If I remove MasterPage it works fine because I can see <html>, <head>, <body> and <form> etc.
Any suggestions or solutions?
Thanks.
From this web form, I call another ASP.Net popup form to pick date from calendar and selected date does not transfer to calling form. If I remove MasterPage it works fine because I can see <html>, <head>, <body> and <form> etc.
Any suggestions or solutions?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
scgstuff:
Following is code which is working fine without inheriting MasterPage in Form1.aspx
Form1.aspx
--------------
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtDate" runat="server" Style="z-index: 104; left: 40px; position: absolute;
top: 48px"></asp:TextBox>
<a href="javascript:;" onclick="window.open('frmC alendar.as px?myContr ol=txtDate ','cal','w idth=225,h eight=200, left=270,t op=180')">
<asp:Image ID="Image1" runat="server" ImageUrl="~/calendar.gif" Style="z-index: 106;
left: 208px; position: absolute; top: 48px" /></a>
</div>
</form>
</body>
</html>
frmCalendar.aspx
--------------------
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Select Date</title>
</head>
<body>
<form id="form2" runat="server">
<div>
<asp:Calendar ID="Calendar1" OnSelectionChanged="Change _Date" Runat="server" >
</asp:Calendar>
<input type="hidden" id="myHidden" runat="server" style="width: 127px" />
</div>
</form>
</body>
</html>
protected void Page_Load(object sender, EventArgs e)
{
myHidden.Value = Request.QueryString["myCon trol"].ToS tring();
}
protected void Change_Date(object sender, System.EventArgs e)
{
string strJScript = "<script>window.opener.doc ument.form s(0)." + myHidden.Value + ".value = '";
strJScript += Calendar1.SelectedDate.ToS tring("MM/ dd/yyyy") + "';self.close()" + "</" + "script>";
ClientScript.RegisterClien tScriptBlo ck(this.Ge tType(), "myScript", strJScript);
}
Following is code which is working fine without inheriting MasterPage in Form1.aspx
Form1.aspx
--------------
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtDate" runat="server" Style="z-index: 104; left: 40px; position: absolute;
top: 48px"></asp:TextBox>
<a href="javascript:;" onclick="window.open('frmC
<asp:Image ID="Image1" runat="server" ImageUrl="~/calendar.gif" Style="z-index: 106;
left: 208px; position: absolute; top: 48px" /></a>
</div>
</form>
</body>
</html>
frmCalendar.aspx
--------------------
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Select Date</title>
</head>
<body>
<form id="form2" runat="server">
<div>
<asp:Calendar ID="Calendar1" OnSelectionChanged="Change
</asp:Calendar>
<input type="hidden" id="myHidden" runat="server" style="width: 127px" />
</div>
</form>
</body>
</html>
protected void Page_Load(object sender, EventArgs e)
{
myHidden.Value = Request.QueryString["myCon
}
protected void Change_Date(object sender, System.EventArgs e)
{
string strJScript = "<script>window.opener.doc
strJScript += Calendar1.SelectedDate.ToS
ClientScript.RegisterClien
}
Thanks,
Shawn