I would like to pass the textbox.text to the javascript function when I click
the button. Besides, by clicking the button, also close the popup window. The
problem is, when I click the button, the textbox.text is successfully pass to
the javascript function and the popup window will be closed, but the popup
window will be opened again in maximize mode. I notice that, after I add the
line 'Me.btnOK.Attributes.Add...' in my Page_Load event, this thing only
happen. Why is it so?
Please help...thanks.
FYI, the following is my page_load code in code-behind:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.btnOK.Attributes.Add("onclick", "Done('" &
txtConnectionString.Text & "');")
End Sub
The following is my html code:
<script language="javascript">
function Done(strConnectionString) {alert(strConnectionString);
window.close();
}
</script
Following is the javascript function's code in parent page to call the
popup-dialog window:
<script language="javascript">
function OpenConnectCubeDialog() {
var ParmA;
var ParmB;
var MyArgs = new Array("", "");
var WinSettings =
"center:yes;resizable:no;dialogHeight:270px;dialogW idth:311px;";
var MyArgs = window.showModalDialog("/ModalDialog/ConnectToCube.aspx",
MyArgs, WinSettings);
if (MyArgs != null) {
ParmA = MyArgs[0].toString();
ParmB = MyArgs[1].toString();
initializePivotTable(ParmA, ParmB);
}
}
</script
Thanks.Hi Chrysan,
This is a common problem with popup windows... Add the code below to your
..aspx file between the <HEAD></HEAD> tags...
<base target="_self"
This will cause the popup window to post to itself and prevent the spawning
of a new window instance.
HTH,
"Chrysan" <Chrysan@.discussions.microsoft.com> wrote in message
news:177F1EBD-C9F1-4794-94AB-3713CFD0CACC@.microsoft.com...
>I have a popup window, which consist of a asp:textbox and a asp:button.
>And,
> I would like to pass the textbox.text to the javascript function when I
> click
> the button. Besides, by clicking the button, also close the popup window.
> The
> problem is, when I click the button, the textbox.text is successfully pass
> to
> the javascript function and the popup window will be closed, but the popup
> window will be opened again in maximize mode. I notice that, after I add
> the
> line 'Me.btnOK.Attributes.Add...' in my Page_Load event, this thing only
> happen. Why is it so?
> Please help...thanks.
> FYI, the following is my page_load code in code-behind:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Me.btnOK.Attributes.Add("onclick", "Done('" &
> txtConnectionString.Text & "');")
> End Sub
>
> The following is my html code:
> <script language="javascript">
> function Done(strConnectionString) { alert(strConnectionString);
> window.close();
> }
> </script>
>
> Following is the javascript function's code in parent page to call the
> popup-dialog window:
> <script language="javascript">
> function OpenConnectCubeDialog() {
> var ParmA;
> var ParmB;
> var MyArgs = new Array("", "");
> var WinSettings =
> "center:yes;resizable:no;dialogHeight:270px;dialogW idth:311px;";
> var MyArgs = window.showModalDialog("/ModalDialog/ConnectToCube.aspx",
> MyArgs, WinSettings);
> if (MyArgs != null) {
> ParmA = MyArgs[0].toString();
> ParmB = MyArgs[1].toString();
> initializePivotTable(ParmA, ParmB);
> }
> }
> </script>
> Thanks.
On Wed, 28 Sep 2005 22:47:03 -0700, Chrysan wrote:
> I have a popup window, which consist of a asp:textbox and a asp:button. And,
> I would like to pass the textbox.text to the javascript function when I click
> the button. Besides, by clicking the button, also close the popup window. The
> problem is, when I click the button, the textbox.text is successfully pass to
> the javascript function and the popup window will be closed, but the popup
> window will be opened again in maximize mode. I notice that, after I add the
> line 'Me.btnOK.Attributes.Add...' in my Page_Load event, this thing only
> happen. Why is it so?
> Please help...thanks.
> FYI, the following is my page_load code in code-behind:
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Me.btnOK.Attributes.Add("onclick", "Done('" &
> txtConnectionString.Text & "');")
> End Sub
>
> The following is my html code:
> <script language="javascript">
> function Done(strConnectionString) {alert(strConnectionString);
> window.close();
> }
> </script>
>
> Following is the javascript function's code in parent page to call the
> popup-dialog window:
> <script language="javascript">
> function OpenConnectCubeDialog() {
> var ParmA;
> var ParmB;
> var MyArgs = new Array("", "");
> var WinSettings =
> "center:yes;resizable:no;dialogHeight:270px;dialogW idth:311px;";
> var MyArgs = window.showModalDialog("/ModalDialog/ConnectToCube.aspx",
> MyArgs, WinSettings);
> if (MyArgs != null) {
> ParmA = MyArgs[0].toString();
> ParmB = MyArgs[1].toString();
> initializePivotTable(ParmA, ParmB);
> }
> }
> </script>
> Thanks.
It looks to me that we are mixing server-side/client-side concepts here.
The popup window's will open a completely independent window; it
javascript event code for the button must also be output by the same asp
that you are generating for the info you are displaying.
I hope this is clear
Thanks a lot...it works.
"Onin Tayson" wrote:
> Hi Chrysan,
> This is a common problem with popup windows... Add the code below to your
> ..aspx file between the <HEAD></HEAD> tags...
> <base target="_self">
> This will cause the popup window to post to itself and prevent the spawning
> of a new window instance.
> HTH,
>
> "Chrysan" <Chrysan@.discussions.microsoft.com> wrote in message
> news:177F1EBD-C9F1-4794-94AB-3713CFD0CACC@.microsoft.com...
> >I have a popup window, which consist of a asp:textbox and a asp:button.
> >And,
> > I would like to pass the textbox.text to the javascript function when I
> > click
> > the button. Besides, by clicking the button, also close the popup window.
> > The
> > problem is, when I click the button, the textbox.text is successfully pass
> > to
> > the javascript function and the popup window will be closed, but the popup
> > window will be opened again in maximize mode. I notice that, after I add
> > the
> > line 'Me.btnOK.Attributes.Add...' in my Page_Load event, this thing only
> > happen. Why is it so?
> > Please help...thanks.
> > FYI, the following is my page_load code in code-behind:
> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> > Me.btnOK.Attributes.Add("onclick", "Done('" &
> > txtConnectionString.Text & "');")
> > End Sub
> > The following is my html code:
> > <script language="javascript">
> > function Done(strConnectionString) { alert(strConnectionString);
> > window.close();
> > }
> > </script>
> > Following is the javascript function's code in parent page to call the
> > popup-dialog window:
> > <script language="javascript">
> > function OpenConnectCubeDialog() {
> > var ParmA;
> > var ParmB;
> > var MyArgs = new Array("", "");
> > var WinSettings =
> > "center:yes;resizable:no;dialogHeight:270px;dialogW idth:311px;";
> > var MyArgs = window.showModalDialog("/ModalDialog/ConnectToCube.aspx",
> > MyArgs, WinSettings);
> > if (MyArgs != null) {
> > ParmA = MyArgs[0].toString();
> > ParmB = MyArgs[1].toString();
> > initializePivotTable(ParmA, ParmB);
> > }
> > }
> > </script>
> > Thanks.
>
0 comments:
Post a Comment