Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 16-Jan-14 4:02am
v2
Comments
ZurdoDev 16-Jan-14 9:59am    
Where are you stuck?
bowlturner 16-Jan-14 10:06am    
My question is why you have to lists of values that are related? Why don't you have an object that holds the Faculty and their ID in one object?

class factulty
{
public string Name {get; set;}
public string Id {get; set;}
public object photo {get; set}
}

then you only need one list and don't have to worry about them getting out of sync.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900