or
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { //access_layerDataContext db=new access_layerDataContext(); ques_tbl t1= new ques_tbl(); if (e.Row.DataItem == "qAnswered") { Image img = (Image)e.Row.FindControl("image1"); if (t1.qanswered == true) { img.ImageUrl = "/images/question_mark.jpg"; } } }
Is my code with simple asp.net Grid
now for telerik I wrote the following but its not helping me .
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item.Cells[1].Text== "True")
{
Image img = (Image)e.Item.FindControl("Image1");
img.ImageUrl = "/images/question_mark.jpg";
}
}
and I am getting this error ,at Line 55 the index is out of Range .
Line 53: {
Line 54: ques_tbl t1 = new ques_tbl();
Line 55: if (e.Item.Cells[1].Text== "True")
Line 56: {
Line 57: Image img = (Image)e.Item.FindControl("Image1");
Dim myIndex As Integer = e.Item.ItemIndexIf myIndex > 0 Then Dim myPK As String = e.Item.OwnerTableView.Items(myIndex)("QuestionID").Text 'Then encrypt from here and add to the function defined in the link in the "template" column.End If