Click here to Skip to main content
14,736,706 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have my Review page, in that 3 fields are there.

review title, Description, and Destination.

When I click submit button, if user is already loggedin, that review will insert in to sql database, otherwise login model popup window will open.

If he/she add credentials, it has to go that review page.

Please help me with jQuery modal popup window.
How to write condition in button code ?

I wrote this button_click:
if(Request.QueryString["userid"] != null)
{
      //insert code..
}
else
{

}
Posted
v2
Comments
vinodkumarnie 6-Mar-13 1:29am
   
can you share your html code that u tried till now..?
suma2212 6-Mar-13 8:01am
   
Hi i used this code

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Show Popup for your website users to Subscribe using jQuery</title>
<!-- Color Box CSS -->
<link media="screen" rel="stylesheet" target="_blank" href="css/colorbox.css" />
<!-- Style For the Subscription Box -->
<link media="screen" rel="stylesheet" target="_blank" href="css/popup.css" />
<script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script>
<script language="javascript" src="js/colorbox.js"></script>
<script type="text/javascript">
function test()
{
alert('me');
return false;
}
</script>
<script type="text/javascript">
function test
{
$("document").ready(function() {
// load the overlay
if (document.cookie["userid".indexOf('visited=true') == -1) {
var fifteenDays = 1000 * 60 * 60 * 24 * 15;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=true;expires=" + expires.toUTCString();
$.colorbox({ width: "580px", inline: true, href: "#subscribe_popup" });
}
$(".open_popup").colorbox({ width: "850px", inline: true, href: "#subscribe_popup" });
});
}

</script>
<script type="text/javascript">
$("document").ready(function() {
// load the overlay
if (document.cookie.indexOf('visited=true') == -1) {
var fifteenDays = 1000 * 60 * 60 * 24 * 15;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=true;expires=" + expires.toUTCString();
$.colorbox({ width: "580px", inline: true, href: "#subscribe_popup" });
}
$(".open_popup").colorbox({ width: "850px", inline: true, href: "#subscribe_popup" });
});
</script>

</head>
<body>
<form id="form1" runat="server">
<div>

headline
<asp:TextBox ID="txtheadline" runat="server">
<br />
write story
<asp:TextBox ID="txtstory" runat="server">
<br />
destination <asp:TextBox ID="txtdestination" runat="server">
<br />
date
<asp:TextBox ID="txtdate" runat="server">
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" style="width: 56px" Text="Button" />

</div>
<div align="center">
Click here to open the popup
</div>
<!-- This contains the hidden content for inline calls for the subscribe box -->
<div style='display:none'>
<div id='subscribe_popup' style='padding:10px;' runat="server">
<div style="width:95%;margin:10px; background-color:White;">
<div style="float:left;width:45%;">
<asp:Panel ID="pnldrag" runat="server" Width="402px" >
<table style="height: 338px; width: 100%" >
<tr>
<td style="color: Black; margin:auto;" class="style5">
 <span style="font-size: 14pt;margin:auto;"><br />
Login<br />
<span style="font-size: 14pt"><span style="font-size: 12pt">
<br />
Have a Facebook Account?<div id="auth-status">
<div ID="auth-loggedout">
<div autologoutlink="true" class="fb-login-button" scope="email,user_checkins">
Login with Facebook</div>
</div>
<div ID="auth-loggedin" style="display: none">
Hi, <span id="auth-displayname"></span>(logout)
</div>
</div>

</span></span></span>
</td>
</tr>
<tr>
<td class="style5">
<table border="0p
suma2212 6-Mar-13 8:06am
   
<tr>
<td class="style7" >
User Name</td>
<td >
<asp:TextBox ID="txtUsername" runat="server">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtUsername" ErrorMessage="*" ValidationGroup="submit">
</td>
</tr>
<!-- password -->
<tr>
<td class="style7" >
Password</td>
<td >
<asp:TextBox ID="txtpwd" runat="server" TextMode="Password">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtpwd" ErrorMessage="*" ValidationGroup="submit">
</td>
</tr>
<tr>
<td class="style8" colspan="2">
                  
<asp:ImageButton ID="ImageButton2" runat="server"
ImageUrl="http://localhost:3072/HAI/UserAdmin/Images/btns_24.jpg" onclick="ImageButton2_Click"
ValidationGroup="submit" />
</td>
</tr>
<tr>
<td class="style7" colspan="2" >
<asp:Label ID="Label1" runat="server" Font-Size="Small" ForeColor="#CC0000">
 </td>
</tr>
</table>

</td>
</tr>

</table>



</div></div></div>

<!-- END subscribe popup-->
</form>
</body>
</html>

view code:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["userid"] == null)
{
//this.Button1.OnClientClick = "javascript:('Button1','')";
this.Button1.Attributes.Add("OnClientClick", "javascript:test();");
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Request.QueryString["userid"] != null)
{
SqlConnection con = new SqlConnection(str);
SqlCommand com = new SqlCommand("Hai_insertstorydetailes", con);
con.Open();
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add("@userId", Request.Cookies["userId"].Value.ToString());
if (Request.QueryString["StoryId"] != null)
{

com.Parameters.Add("@Id", Request.QueryString["StoryId"].ToString());
}
com.Parameters.Add("@Headline", txtheadline.Text);
com.Parameters.Add("@WriteStory", txtstory.Text);
com.Parameters.Add("@Destination", txtdestination.Text);
com.Parameters.Add("@Date", txtdate.Text);
com.ExecuteNonQuery();
con.Close();
}
else
{

}

this code working for hyperlink. but when i apply to button its not working...
when i submit review if user logged in it will save in db. other modelpodel popup window will open and when i submit user credentials it will go to that review page.

please help me........

1 solution

Codeproject itself have 1 solid solution which may help you in your application. Check the following url.

Url : http://www.codeproject.com/Articles/488312/jQuery-Modal-Dialog-with-Dynamic-Content
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900