RowDataBound inGridview

18/04/2012 09:43

 

protected void gvGetAppt_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState == DataControlRowState.Normal))
        {
            e.Row.Attributes.Add("onmouseover", "javascript:this.className = 'MouseOverStyle'");
            e.Row.Attributes.Add("onmouseout", "javascript:this.className = 'RowStyle'");
        }
        if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState == DataControlRowState.Alternate))
        {
            e.Row.Attributes.Add("onmouseover", "javascript:this.className = 'MouseOverStyle'");
            e.Row.Attributes.Add("onmouseout", "javascript:this.className = 'AltRowStyle'");
        }
 
 
 
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int accno = int.Parse(((Label)e.Row.FindControl("lblaccno")).Text);
 
            patients patt = new patients();
            int count = patt.getapptpattcount(accno);
 
            if (count >= 1)
            {
                ImageButton imgcreatepatt = ((ImageButton)e.Row.FindControl("btnCreate"));
                imgcreatepatt.ImageUrl = "images/createPatient.png";
                imgcreatepatt.Enabled = false;
 
            }
            else if (count == 0)
            {
 
 
                ImageButton imgcreateiv = ((ImageButton)e.Row.FindControl("btnIV"));
                imgcreateiv.ImageUrl = "images/IV.png";
                imgcreateiv.Enabled = false;
 
                ImageButton imgcreatepa = ((ImageButton)e.Row.FindControl("btnPA"));
                imgcreatepa.ImageUrl = "images/PreAuthor.png";
                imgcreatepa.Enabled = false;
 
 
            }
 
 
 
        }
 
 
 
    }