C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

How to get selected date value from popup form to my original form.


Posted Date: 03 Nov 2008      Posted By: Anand      Member Level: Bronze     Points: 1   Responses: 3



Hi 2 everyone,
I have a aspx page from that am opening another aspx page through javascript, it works fine. In that popup page i have calendar control, now i want to select date from that control and pass that value to my orignal page and i have to close that popup page. Any Ideas plz..





Responses

Author: Gaurav Agrawal    03 Nov 2008Member Level: DiamondRating: 3 out of 53 out of 53 out of 5     Points: 3

in first page by where u r calling popup window

on page load
hlnk_cal.NavigateUrl = "javascript:calendar_window=window.open('calendar.aspx?formname=" + Form.Name.ToString() + "." + txt_date.ClientID.ToString() + "','calendar_window','width=250,height=225');calendar_window.focus()";

in my popup window

aspx code
<body>
<form id="form1" runat="server">
<asp:Calendar ID="cal" runat="server" OnSelectionChanged="cal_SelectionChanged" CssClass="textbox">
</asp:Calendar>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</form>
</body>

and .cs code
public void cal_SelectionChanged(object sender, EventArgs e)
{
string strjscript = "<script language='javascript'>";
strjscript += "window.opener.document." + Request.QueryString["formname"] + ".value = '" + cal.SelectedDate.Date.ToShortDateString() + "';window.close();";
strjscript = strjscript + "</script" + ">" ;
Literal1.Text = strjscript;
}

GA

Thanks & Regards,

Gaurav Agrawal
Sr.Software Engineer
gaur1982@yahoo.com
09829373514



Author: Anand    03 Nov 2008Member Level: BronzeRating: 1 out of 5     Points: 1

In first page on button click am calling the javascript


Author: Anand    03 Nov 2008Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

thanks Gaurav.. it works fine, it possible to do the same without using hyperlink.. Any other method? plz..


Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : in asp.net using c# i wants to validate an email id by writing javascript
Previous : User not trusted with a SQL server connection -
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use