Problem in retrieve image in gridview

Oct 31 2009 1:37 AM
I am retrieveing image from folder in gridview, images name is save as enrolno. My code is
 <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:Image ID="myimage" runat="server" ImageUrl='<%# get_url(Eval("enrolno").ToString()) %>' Height="59px" Width="50px"/>
                                </ItemTemplate>
                            </asp:TemplateField>

  public String get_url(String str)
    {
        if (str != null && str.Length > 0)

            return ("~/CandidateImages/" + str);

        else return null;
}
i m getting the path right but the image is not displayng in gridview can anyone tell me wht the problem.


Answers (1)