Expand|Select|Wrap|Line Numbers
- .cs
- protected void grdVPlayer_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- try
- { if (e.Row.RowType == DataControlRowType.DataRow)
- {
- CheckBox objCheck = new CheckBox();
- objCheck = (CheckBox)e.Row.FindControl("chkPlayer");
- objCheck.ID = "chk" + e.Row.RowIndex.ToString();
- // RB for captain
- RadioButton OBjWicketkeeper = new RadioButton();// RB for W.keeper
- RadioButton ObjrbVC = new RadioButton();
- RadioButton ObjrbCaptain = new RadioButton();
- OBjWicketkeeper = (RadioButton)e.Row.FindControl("rbWk");
- OBjWicketkeeper.ID = "WK" + e.Row.RowIndex.ToString();
- OBjWicketkeeper.InputAttributes.Add("disabled", "true");
- ObjrbVC = (RadioButton)e.Row.FindControl("rbVcaptain");
- ObjrbVC.ID = "RBVC" + e.Row.RowIndex.ToString();
- ObjrbVC.GroupName = "MyGroup";
- ObjrbVC.InputAttributes.Add("disabled", "true");
- ObjrbCaptain = (RadioButton)e.Row.FindControl("rbcaptain");
- ObjrbCaptain.ID = "RBC" + e.Row.RowIndex.ToString();
- ObjrbCaptain.GroupName = "MyGroup";
- ObjrbCaptain.InputAttributes.Add("disabled", "true");
- ObjrbCaptain.Attributes.Add("onclick", "CheckClickforCaptain(this," + e.Row.ClientID + ",'" + ObjrbCaptain.ClientID + "','" + ObjrbVC.ClientID + "')");
- }}
- js
- function CheckClickforCaptain(objCaptain, rowCap, CaptainRButton, ViceCaptainRButton)
- {
- var gridView = document.getElementById("<%=grdVPlayer.ClientID %>");
- var totalrowsingrid = gridView.rows.length;
- if (objCaptain.checked) {
- if (Captain == '') //display captain
- {
- Captain = rowCap.cells[2].innerText; // display captain name
- alert(Captain);
- }
- else // (Captain != '') //if captain is already decided then ....
- {
- var confirmVariable = confirm("Do You Want to change the Captain which you have decided !");
- if (confirmVariable == true) {
- alert("You Press Ok!");
- alert("Captain=" + Captain + "ViceCaptain=" + ViceCaptain);
- <b> for (var i = 0; i < totalrowsingrid - 1; i++) {
- var j = 2 + i;
- if (j < 10) {
- var ClientID = "ctl00_MainContentPlaceHolder1_grdVPlayer_ctl0" + j + "_RBC" + i;
- }
- else {
- var ClientID = "ctl00_MainContentPlaceHolder1_grdVPlayer_ctl" + j + "_RBC" + i;
- }
- // ClientID.checked=false;
- document.getElementById(ClientID).checked = false;
- <b>
Expand|Select|Wrap|Line Numbers
- for (var i = 0; i < totalrowsingrid - 1; i++) {
- var j = 2 + i;
- if (j < 10) {
- var ClientID = "ctl00_MainContentPlaceHolder1_grdVPlayer_ctl0" + j + "_RBC" + i;
- }
- else {
- var ClientID = "ctl00_MainContentPlaceHolder1_grdVPlayer_ctl" + j + "_RBC" + i;