Hi
i have 1 table
ecode ename Photoname Photofileid (Guid)
1 aa a.jpg 1234-34-3434
1 aa b.jpg 3234-34-3432
2 bb k.bmp 3456-22-2323
I want in outer grid it should display ecode , ename & edit Button
In inner grid i want photoname , image (which is stored as file) & (Open/Delete) Button
From above data there will be 2 inner rows , in 2 there will be 1 record
If Data exists for internal row then +sign or some other image should be displayed on left of outer grid which should be collapsible.
Thanx
Loading
Vijay YadavPosted Jan 26, 2012, 3:02 AM
Vijay YadavPosted Jan 26, 2012, 2:51 AM
Suppose there are 2 grdiview
Outer one is Grdivew1 and Inner is Gridview2
On page load event:
You need to give the datasource and databind to the outer
For inner Gridview
Write the code on the first grdiview Rowdatabound
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Label lb = (Label)e.Row.FindControl("lblECode"); //your emp code
GridView gr = (GridView)e.Row.FindControl("Gridview2");
if (gr != null)
{
con = new SqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString; con.Open();
cmd = new SqlCommand("select * from tblEmp where Ecode='" + lb.Text + "'", con);
dr = cmd.ExecuteReader();
gr.DataSource = dr;
gr.DataBind();
}