TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
narasiman rao
NA
519
765.8k
how to display images from folderto gridview in asp.net
Jan 16 2014 11:57 PM
My code as follows
protected void Page_Load(object sender, EventArgs e)
{
Lstfaculty.Items.Add("Raj");
Lstfaculty.Items.Add("suresh");
Lstfacid.Items.Add("1");
Lstfacid.Items.Add("2");
SetInitialRow();
}
private void SetInitialRow()
{
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add("Faculty Name", typeof(string));
dt.Columns.Add("Faculty ID", typeof(string));
dt.Columns.Add("Photo",typeof(string));
for (int i = 0; i < Lstfaculty.Items.Count; i++)
{
dr = dt.NewRow();
dr["Faculty Name"] = Lstfaculty.Items[i].Text.ToString();
dt.Rows.InsertAt(dr, i);
}
for (int i = 0; i < dt.Rows.Count; i++)
{
dt.Rows[i]["Faculty ID"] = Lstfacid.Items[i].Text;
gvfaculty.DataSource = dt;
gvfaculty.DataBind();
}
}
When i execute my above code output as follows in Gridview
Faculty Name Faculty ID Photo
Raj 1
suresh 2
The above Raj and suresh images are stored in under E Folder Facultyimage.
in this Facultyimage folder(E Folder) the Raj and suresh images are there.
i want output as follows in Gridview
when i click the Raj(Faculty Name) in the gridview, i want to display the Raj image in the Photo column in gridiview.
Similarily when i click the suresh(Faculty Name) in the gridview, i want to display the suresh image in the Photo column in gridiview.
for that how can i do in asp.net using Csharp.
Regards,
Narasiman P.
Reply
Answers (
0
)
Input string was not in a correct format.
Sort c# List that contains json object