G
Guest
i am puzzled. i have previously bound datasets to datagrids which contain the filename of IMAGES. And i use template columns to show the image for each row. But now it is not working. I have reviewed the code for over two days and I am still stuck. Here is the template column as it is in the datagrid now
<asp:TemplateColumn HeaderText="Status"><ItemTemplate><asp:Image id=Image4 runat="server" ImageUrl='<%# gridGetImagePath (DataBinder.Eval(Container, "DataItem.nStatus").ToString ()) %>'></asp:Image></ItemTemplate></asp:TemplateColumn
the gridGetImagePath is a function that returns a string representing the filename of the image to display. I used debugging techniques in visual studio and discovered that control doesn't even ENTER that function!
here is the code that displays the grid through code
approvalPendingPoliciesSet.Clear ()
sqlApprovalPendingPoliciesDataAdapter.Fill (approvalPendingPoliciesSet)
approvalGrid.DataSource = approvalPendingPoliciesSet
approvalGrid.DataMember = "TPolicy"
approvalGrid.DataKeyField = "IDPolicy"
// Set up column
approvalGrid.DataBind ()
Of course, except for the template column given above and some others, other columns are generated through code which i have not shown above. All other columns appear normally. This is the only column that doesn't show the image
To make things MORE CONFUSING, i tried putting ORDINARY Labels (with no databinding). NOTHING I put in that template column comes on the screen. Something fishy upon that column? :-
Help! Thanks :
Michell
<asp:TemplateColumn HeaderText="Status"><ItemTemplate><asp:Image id=Image4 runat="server" ImageUrl='<%# gridGetImagePath (DataBinder.Eval(Container, "DataItem.nStatus").ToString ()) %>'></asp:Image></ItemTemplate></asp:TemplateColumn
the gridGetImagePath is a function that returns a string representing the filename of the image to display. I used debugging techniques in visual studio and discovered that control doesn't even ENTER that function!
here is the code that displays the grid through code
approvalPendingPoliciesSet.Clear ()
sqlApprovalPendingPoliciesDataAdapter.Fill (approvalPendingPoliciesSet)
approvalGrid.DataSource = approvalPendingPoliciesSet
approvalGrid.DataMember = "TPolicy"
approvalGrid.DataKeyField = "IDPolicy"
// Set up column
approvalGrid.DataBind ()
Of course, except for the template column given above and some others, other columns are generated through code which i have not shown above. All other columns appear normally. This is the only column that doesn't show the image
To make things MORE CONFUSING, i tried putting ORDINARY Labels (with no databinding). NOTHING I put in that template column comes on the screen. Something fishy upon that column? :-
Help! Thanks :
Michell