Click here to Skip to main content
15,843,623 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to bind a datalist in header of gird view but on rendering the data list is not displayed . Can anyone help me

My code
C#
//  Binding header
if (e.Row.RowType == DataControlRowType.Header)
{
   DataList dlstShiftHead = (DataList)e.Row.FindControl("dlstShiftHead");
   dlstShiftHead.DataSource = lstRevenueAttributesDTO[0].ShiftDTOList;
   dlstShiftHead.DataBind();
}

The datalist is in the header template of gridview header coloumn
Posted
Updated 24-May-12 12:03pm
v2
Comments
Mohamed Mitwalli 24-May-12 7:17am    
Can you Share your code ?
Sharib Ahmad 24-May-12 9:09am    
Yeah sure here is my code

// Binding header
if (e.Row.RowType == DataControlRowType.Header)
{
DataList dlstShiftHead = (DataList)e.Row.FindControl("dlstShiftHead");
dlstShiftHead.DataSource = lstRevenueAttributesDTO[0].ShiftDTOList;
dlstShiftHead.DataBind();
}
The datalist is in the header template of gridview header coloumn

See this similar discussion:(solved)
Bind datalist inside a gridview column[^]
 
Share this answer
 
Comments
Sharib Ahmad 24-May-12 9:10am    
NO this is not the problem problem is that my datalist is in the header of gridview
Prasad_Kulkarni 19-Jul-12 4:52am    
5'ed
C#
GridViewRow Hrow = GridviewID.HeaderRow;
DataList dlstShiftHead = (DataList)Hrow .FindControl("dlstShiftHead");
dlstShiftHead.DataSource = lstRevenueAttributesDTO[0].ShiftDTOList;
  dlstShiftHead.DataBind();
 
Share this answer
 
Comments
Sharib Ahmad 25-May-12 12:15pm    
no it didnt worked infact i tried it on all user controls but it didnt worked

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