Gridview popup create using ajax
Create Assembly
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1"
Create CSS Popup
<style type="text/css">
.modalPopup1
{
background-color : #87BEE1;
padding: 10px 0px 10px 0px;
padding-left: 10px;
width: 50px;
height :auto;
}
.modalBackground
{
background-color: Black;
filter: alpha(opacity=40);
opacity: 0.4;
}
.modalPopup
{
background-color: #FFFFFF;
width: 400px;
border: 3px solid #666666;
}
.modalPopup .header
{
background-color: #666666;
height: 30px;
color: White;
line-height: 30px;
text-align: center;
font-weight: bold;
}
.modalPopup .body
{
min-height: 50px;
line-height: 30px;
text-align: center;
padding:5px
}
.modalPopup .footer
{
padding: 3px;
}
.modalPopup .button
{
height: 23px;
color: White;
line-height: 23px;
text-align: center;
font-weight: bold;
cursor: pointer;
background-color: #9F9F9F;
border: 1px solid #666666;
}
</style>
Script to close popup
<script type="text/javascript">
function pageLoad(sender, args) {
if (!args.get_isPartialLoad()) {
// add our handler to the document's
// keydown event
$addHandler(document, "keydown", onKeyDown);
}
}
function onKeyDown(e) {
if (e && e.keyCode == Sys.UI.Key.esc) {
// if the key pressed is the escape key, dismiss the dialog
$find('addAttribute1').hide();
//$find('editAttribute1').hide();
}
}
</script>
create click event
protected void lnk_report_click(object sender, EventArgs e)
{
//REVIEWER report panel
GridViewRow clickedRow = ((ImageButton)sender).NamingContainer as GridViewRow;
Label lblID = (Label)clickedRow.FindControl("LBLID");
Label lblemail = (Label)clickedRow.FindControl("Label10");
Label lblname = (Label)clickedRow.FindControl("auname");
Label8.Text = lblID.Text;
Label11.Text = lblemail.Text;
Label12.Text = lblname.Text;
Button2.Visible = false;
var closeLink = (Control)sender;
GridViewRow row = (GridViewRow)closeLink.NamingContainer;
Label9.Text = row.Cells[3].Text; // here we are
foreach (GridViewRow r1 in GridView1.Rows)
{
if (r1.Cells[3].Text == "APPROVE")
{
Button2.Visible = true;
}
}
ModalPopupExtender2.Show();
panelassign.Visible = false;
panelrev.Visible = true;
}
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1"
Create CSS Popup
<style type="text/css">
.modalPopup1
{
background-color : #87BEE1;
padding: 10px 0px 10px 0px;
padding-left: 10px;
width: 50px;
height :auto;
}
.modalBackground
{
background-color: Black;
filter: alpha(opacity=40);
opacity: 0.4;
}
.modalPopup
{
background-color: #FFFFFF;
width: 400px;
border: 3px solid #666666;
}
.modalPopup .header
{
background-color: #666666;
height: 30px;
color: White;
line-height: 30px;
text-align: center;
font-weight: bold;
}
.modalPopup .body
{
min-height: 50px;
line-height: 30px;
text-align: center;
padding:5px
}
.modalPopup .footer
{
padding: 3px;
}
.modalPopup .button
{
height: 23px;
color: White;
line-height: 23px;
text-align: center;
font-weight: bold;
cursor: pointer;
background-color: #9F9F9F;
border: 1px solid #666666;
}
</style>
Script to close popup
<script type="text/javascript">
function pageLoad(sender, args) {
if (!args.get_isPartialLoad()) {
// add our handler to the document's
// keydown event
$addHandler(document, "keydown", onKeyDown);
}
}
function onKeyDown(e) {
if (e && e.keyCode == Sys.UI.Key.esc) {
// if the key pressed is the escape key, dismiss the dialog
$find('addAttribute1').hide();
//$find('editAttribute1').hide();
}
}
</script>
create click event
protected void lnk_report_click(object sender, EventArgs e)
{
//REVIEWER report panel
GridViewRow clickedRow = ((ImageButton)sender).NamingContainer as GridViewRow;
Label lblID = (Label)clickedRow.FindControl("LBLID");
Label lblemail = (Label)clickedRow.FindControl("Label10");
Label lblname = (Label)clickedRow.FindControl("auname");
Label8.Text = lblID.Text;
Label11.Text = lblemail.Text;
Label12.Text = lblname.Text;
Button2.Visible = false;
var closeLink = (Control)sender;
GridViewRow row = (GridViewRow)closeLink.NamingContainer;
Label9.Text = row.Cells[3].Text; // here we are
foreach (GridViewRow r1 in GridView1.Rows)
{
if (r1.Cells[3].Text == "APPROVE")
{
Button2.Visible = true;
}
}
ModalPopupExtender2.Show();
panelassign.Visible = false;
panelrev.Visible = true;
}