Hi experts,
we are facing challenges in converting an exisitng asp.net gridview to radgrid hosted by a radpanel. below is the existing asp.net gridview code which we are trying to convert to radgrid. Issue is we are not able to get the reference to the controls hosted by the radgrid for eg. Label)e.Row.FindControl("lblRole"), is always returning null. Please note that container for the radgrid is radpanel. Tried looping the controls collection and finding the control by using ID (lblrole) but still noluck. any help is appreciated
we are facing challenges in converting an exisitng asp.net gridview to radgrid hosted by a radpanel. below is the existing asp.net gridview code which we are trying to convert to radgrid. Issue is we are not able to get the reference to the controls hosted by the radgrid for eg. Label)e.Row.FindControl("lblRole"), is always returning null. Please note that container for the radgrid is radpanel. Tried looping the controls collection and finding the control by using ID (lblrole) but still noluck. any help is appreciated
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) |
{ |
string strPrimary = string.Empty; |
string sCopy = string.Empty; |
if (e.Row.RowType == DataControlRowType.DataRow) |
{ |
Label lblRole = (Label)e.Row.FindControl("lblRole"); |
RadioButtonList rbroles = (RadioButtonList)e.Row.FindControl("rbroles"); |
Label lbldelete = (Label)e.Row.FindControl("lbldelete"); |
rbroles.SelectedValue = lblRole.Text; |
CheckBox chk = (CheckBox)e.Row.FindControl("chkUser1"); |
if (lbldelete != null) |
{ |
if (string.Compare(lbldelete.Text, "true", true) == 0) |
//if (lbldelete.Text.Equals("true",StringComparison.InvariantCultureIgnoreCase) |
{ |
chk.Checked = true; |
} |
} |
if (hdnCurrenUserRole.Value.Length > 0) |
{ |
currentUserRole = Int32.Parse(hdnCurrenUserRole.Value); |
} |
if (currentUserRole == (int)Role.Owner || IsAdmin) |
{ |
rbroles.Enabled = true; |
chk.Enabled = true; |
} |
else |
{ |
rbroles.Enabled = false; |
chk.Enabled = false; |
} |
} |
} |