Andy0000
Joined: 15 Jan 2008 Posts: 4
|
Posted: Tue Jan 15, 2008 9:42 am Post subject: Modal Window |
|
|
Hi Guys,
I am new to Field of .Net and JavaScript.
I have a problem regarding Modal Window.
I have created a page in which when there is textbox and a button. Now when the user clicks on the button, a modal window should open in which there is calender control(for this I have created a another aspx page and added calender control on it.) I am calling this function on the button click
INSIDE PARENT WINDOW
-------------------------------------
function openCalender(id)
{
//I am sending the selected date to the calender control, to display the date that is in textbox
var selDate=document.getElementById(id).value;
var retVal=""
var valReturned;
//alert(selDate);
retVal=window.showModalDialog("DatePicker.aspx?formname=document.getElementById(\""+id+"\")&selectedDate="+selDate,retVal,"dialogWidth:230px;dialogHeight:190px");
valReturned=retVal;
document.getElementById(id).value=valReturned;
}
INSIDE MODAL WINDOW(CALENDER.ASPX)
--------------------------------------------------------------
protected void Calendar1_SelectionChanged(Object sender, System.EventArgs e)
{
string strjscript = "<script language='javascript'>";
strjscript += "window.returnValue= ' " + Calendar1.SelectedDate.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern)+"';window.close();";
strjscript += "</script" + ">";
Literal1.Text = strjscript; //For putting the script
-------------------------------------------------------
Now as far as I think, I am returning the selected date through return.Value. But its now working. I tried to use alert and see what value it is returning. it was "undefined"
We cannot use window.opener because window.showModalDialog doesnot support it................ |
|