Search This Blog

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] +");");

2 comments :

Anonymous said...

I want change of row color on mouse over. I need there should be a default row color then I want to change ths on mouse over. How to do that.?

Bad Boy said...

How to hidd the visibility of item templete inside the repeter control at runtime on the basis of condition