All pastes #168996 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-09-13 15:03 UTC
rendered paste body
// I call this to register all controls of all rows in the gridview
protected void RegisterValuesForGridview()
	{
		foreach (GridViewRow row in this.gvTools.Rows)
		{
			// Page.ClientScript.RegisterForEventValidation(this.gvTools.UniqueID);
			foreach (Control c in row.Controls)
			{
				Page.ClientScript.RegisterForEventValidation(c.UniqueID);
			}
			
			
		}
	}


protected override void Render(HtmlTextWriter output)
	{
		RegisterValuesForGridview();
		base.Render(output);		
	}



// now the DataRowBound thing: 
protected void gvTools_RowDataBound(object sender, GridViewRowEventArgs e)
	{
		if (e.Row.RowType == DataControlRowType.DataRow)
		{
			string js = Page.ClientScript.GetPostBackEventReference(gvTools, "Select${0}");
			js = String.Format(js, e.Row.RowIndex);
			e.Row.Attributes["onclick"] = js;
			e.Row.Style.Add("cursor", "hand");
		}
	}