Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi,
i have DropDownList in footer whene i want to find my drop down list to bind it i get error Object reference not set to an instance of an object. i try to bind it in RowDataBound event
this is my code

DropDownList drp_pmm = gv_pm.FooterRow.FindControl("drp_pmm") as DropDownList;


XML
<FooterTemplate>
                       <asp:DropDownList ID="drp_pmm" runat="server"></asp:DropDownList>
                   </FooterTemplate>
Posted

1 solution

The RowDataBound event is too early - the GridView doesn't create its footer row until all rows have been created and data-bound.

Try the grid's DataBound event instead.
 
Share this answer
 
Comments
Member 11573837 9-Jul-15 11:00am    
hi Richard Deeming,
thank you for answering me it works
Member 11573837 9-Jul-15 11:08am    
hi Richard Deeming,
whene i want to get the selected value i always get the first value if i use
if(!IsPostBack)
{
fillcountry();
}
in DataBound the dropdownlist never be bind
plz what's the solution

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