Although ASP.NET is new to me, I still feel foolish asking such a simple question about a common task required for millions of web sites. I've spent hours seeking the answer, but without success, probably because it's so common and simple that everyone is expected to know it.
An InformationRequired page has an 'Agree to Terms & Conditions' checkbox. If it's unchecked when the Submit button is clicked, a message box is displayed; If it's checked when the Submit button is clicked, a Content page is displayed in a new window. I can do everything except the last bit. Here's the code:
----------------------------------------------------------------------
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
'Has the visitor agreed to the T&C?
If chkTC.Checked Then
'Open new browser window for Content.aspx
CAN ANYONE PROVIDE THE CODE TO GO HERE, PLEASE?
Else
MsgBox("You must agree to the TERMS & CONDITIONS by selecting the box before proceeding.")
End If
End Sub
End Class
----------------------------------------------------------------------
StevePosted Sep 21, 2007, 1:19 PM
abhishek trivediPosted Sep 21, 2007, 8:07 AM
Abhishek Here!!!
i am not getting you only want to open new window or open window and close that particular window.
i am supposing you want to open second window after submittion of first page,
i that case
if (checkbox,checked==true)
{
response.redirect("yourpage.aspx");
}
else
{
lable.text="please check agreement button to proceed";
}
other way you want to open second window and also let first one open which i dont think right in your case because first page has nothing to left now,but let's consider that situation as well and for that you have to follow Kavita's reply.
I hope it will help you.
kavitaPosted Sep 21, 2007, 7:49 AM
for that purpose u have to call a javascript function that generate a popupwindow.write this code on page load to call javascript function:
Button1.Attributes.Add("onclick", "return val()")
put this code in html part in head tag:
hope it work fine.
last I want to say don't underestimate yourself.everybody is beginner today & experience tomorrow.
best of luck