asp.net gridview ImageField path

Hi experts,

I have a asp.net gridview question.

In my gridview i have one image field that looks like this:

            <asp:ImageField DataImageUrlField="IMAGE_PATH"
                DataImageUrlFormatString="images/{0}" HeaderText="document image">
            </asp:ImageField>

In my Sql server in table1 I chave a column called IMAGE_PATH
and the value in the column looks like this:   picture1.jpg

So in my asp.net project, i have  a folder called images and that is where my few images are physically located.

So the above code shows my images in the gridview just fine.

My question is this:

What if instead I stored my images instead at some location on my c drive such as  C:\asp\images  instead of in a folder in my project.

So, In my Sql server in table1 I would have a column called IMAGE_PATH
and the values in the column would look like this:  

C:\asp\images\picture1.jpg
C:\asp\images\picture2.jpg

How would i write that in imy ImageField tag?  Can anyone help
I tried the following, but that didn't seem to work

            <asp:ImageField DataImageUrlField="IMAGE_PATH"
                DataImageUrlFormatString="C:\asp\images/{0}" HeaderText="document image">
            </asp:ImageField>

Can anyone help?

Thanks.
LVL 1
maqskywalkerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Shaun KlineConnect With a Mentor Lead Software EngineerCommented:
Unless the c:\asp\images folder is a virtual directory for your project site, you will not be able to reference files in that manner. Your images folder must be a relative or absolute path for your web server.
0
All Courses

From novice to tech pro — start learning today.