protected void grd_comm_grp_SelectedIndexChanged(object sender, EventArgs e) { CheckBox cbSelection = (CheckBox)sender; GridViewRow row = (GridViewRow)cbSelection.NamingContainer; TextBox CenterSequence = (TextBox)row.FindControl("CenterSequence"); // If Checked if (cbSelection.Checked) { // Enable the TextBox CenterSequence.Enabled = true; // Find Rows with sequence value var ValidSequences = grd_comm_grp.Rows.Cast<GridViewRow>().Where(a => ((TextBox)a.FindControl("CenterSequence")).Text != "").ToList(); // If there are any sequences, increment by 1 if (ValidSequences.Count > 0) CenterSequence.Text = (Convert.ToInt32(ValidSequences.Max(a => ((TextBox)a.FindControl("CenterSequence")).Text)) + 1).ToString(); // If new, put 1 else CenterSequence.Text = "1"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)