Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,i have written a grid view to display image and a datafield,the problem is i am not able to get index for the images.
how to call Gridview1_Ondatabound in indexing?

C#
protected void GridView1_OnDataBound(object sender, GridViewRowEventArgs e)
    {
        string imglac;
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            imglac = e.Row.Cells[0].Text;
            (e.Row.Cells[1].FindControl("Image") as Image).ImageUrl = "~/upload/images/" + imglac;
        }
    }

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        this.GetData();

    }
Posted

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