GridView column issues.

reder

Member
Joined
Oct 2, 2008
Messages
8
Programming Experience
3-5
Firstly, any help here would be great. Its been a while since I worked with gridviews.

I am developing in VS2005, .NET 2.0, SQL Server 2005.

I have a gridview on a page and I am binding (autogenerate columns = true) a datatable to it. Unfortunately, I have no choice but to have the autogeneration = true because the columns in the gridview will be different for different classes of users. Anyway, I have 2 columns which specify the path of an image .../folder1/image.jpg and I wish to convert these to columns displaying the image as opposed to a path. Any ideas on how to go about this. Should I add a new image columns and mirror the values from the other column.

Also, I need to implement sorting for all columns in the gridview. How can I specify a sortexpression for each column? The gridview will have 0 columns.
 
Your jumping around to a few different problems, you may get more responses if you limit it to one question at a time or at least detail each problem better.

There was another recent thread on here about displaying an image in a dataset if you want to do a bit of searching.

What do you mean by sorting, simply ordering columns; this can be done through datagridview properties?

Also what do you mean the gridview will have zero columns, there will be nothing to display?
 
I have 2 columns which specify the path of an image .../folder1/image.jpg and I wish to convert these to columns displaying the image as opposed to a path. Any ideas on how to go about this.
Use the GridView.RowDataBound Event to change the cell text from url to an image tag:
VB.NET:
e.Row.Cells(1).Text = String.Format("<img src=""{0}"" alt=""some text"" />", e.Row.Cells(1).Text)
 
Back
Top