Search This Blog

Showing posts with label popup window. Show all posts
Showing posts with label popup window. Show all posts

Tuesday, April 19, 2011

Call popup in grid

open pop by function in grid uesing javascript.
 protected void Grid_Author_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[8].Attributes.Add("onclick", "return ConfirmDeletion();");
        }
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[6].Attributes.Add("onclick", "return popup("+ Grid_Author.DataKeys[e.Row.RowIndex].Value +");");
        }
    }

<script language="javascript" type="text/javascript">
function ConfirmDeletion()
{
return confirm('Are you sure you want to delete this record?');
}
function popup(getID)
{
window.open('Detail.aspx?AuthorID='+getID,'BaseWork','dialogWidth:120px;');
}
</script>
set grid property DataKeyNames=sno,title,.......
  e.Row.Cells[6].Attributes.Add("onclick", "return popup("+ Grid_Author.DataKeys[e.Row.RowIndex].Values[1] +","+Grid_Author.DataKeys[e.Row.RowIndex].Values[2] +");");