Click here to Skip to main content
14,735,181 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a condition in which i want to show the pop up div on page load, depending on querystring. like if query string value not null or empty then i want to show popup message else close the popup.

my Code
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/base/jquery-ui.css"
type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"
type="text/javascript"></script>
<script type="text/javascript">


$(function () {




var hiddenControlValue = document.getElementById('<%= myHiddenField.ClientID %>').value;


if (hiddenControlValue=="true") {
$('#dialog').dialog({
modal: 'true',
title: 'title'
});
}


});

</Head>
<body>
<form>
<asp:HiddenField ID="myHiddenField" runat="server" />
    <div id="dialog" title="Basic dialog" style="display:none;">
        <%--<p>
            This is the default dialog which is useful for displaying information. The dialog
            window can be moved, resized and closed with the 'x' icon.</p>--%>
            <p class="txtaligncenter"> <asp:Label ID="lblLoginMsg" CssClass="failureNotification" runat="server"></asp:Label>&nbsp;


           <asp:Button ID="btnOk" runat="server" OnClick="btnOk_Click" Text="Ok" ClientIDMode="Static" 

              



    </div>



<form>
</body>
my c# code is
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string isonline = Request.QueryString["Isonline"];
if (isonline != null)
{
lblLoginMsg.Text ="My message here";
myHiddenField.Value = "true";
}
}

this code work realy but problem is that there isa button btnOk in popup div, i want to some work on server side onclick this button but my event not fire

someone help me

thanks in advance
Posted
Updated 4-Apr-13 23:35pm
v7
Comments
Anuja Pawar Indore 5-Apr-13 5:07am
   
Use code block for code....

// ***this goes on the global scope
// get querystring as an array split on "&"
var querystring = location.search.replace( '?', '' ).split( '&' );
// declare object
var queryObj = {};
// loop through each name-value pair and populate object
for ( var i=0; i<querystring.length; i++ ) {
      // get name and value
      var name = querystring[i].split('=')[0];
      var value = querystring[i].split('=')[1];
      // populate object
      queryObj[name] = value;
}

// ***now you can use queryObj["<name>"] to get the value of a url
// ***variable
if ( queryObj[ "delete" ] === "1" ) {
      tab_crevents.show()
}
   
just replace <asp:button id="btnOk" runat="server" onclick="btnOk_Click" text="Ok" clientidmode="Static" xmlns:asp="#unknown">

to linkButton
<asp:linkbutton id="lbtnOk" runat="server" onclick="lbtnOk_Click" xmlns:asp="#unknown">Click here to Continue

my c# code

protected void lbtnOk_Click(object sender, EventArgs e)
  {
      if (Request.QueryString["Isonline"] != null)
      {
         //do somthing
      }
     
  }
   

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