Sunday, December 16, 2012

Add a property to gridview and enable required field validator on checkbox checked event.


Add Property to a gridview to use with Javascript.

 protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
      #region Add-Parameter-onJavaScript-Functions
           if (e.Row.RowType == DataControlRowType.DataRow)
          {
            CheckBox chk = new CheckBox();
            chk = e.Row.FindControl("chkIsEdit") as CheckBox;
            chk.Attributes.Add("onChange", "EnableFields(" + e.Row.RowIndex.ToString() + ")");
          }
      #endregion
    }

------------------------------------------------------
Javascript Code 
------------------------------------------------------ 

No comments:

Post a Comment

Sunday, December 16, 2012

Add a property to gridview and enable required field validator on checkbox checked event.


Add Property to a gridview to use with Javascript.

 protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
      #region Add-Parameter-onJavaScript-Functions
           if (e.Row.RowType == DataControlRowType.DataRow)
          {
            CheckBox chk = new CheckBox();
            chk = e.Row.FindControl("chkIsEdit") as CheckBox;
            chk.Attributes.Add("onChange", "EnableFields(" + e.Row.RowIndex.ToString() + ")");
          }
      #endregion
    }

------------------------------------------------------
Javascript Code 
------------------------------------------------------ 

No comments:

Post a Comment