Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I've use this code for fill value in drop down which is used in grid view but its generate an error "Object reference not set to an instance of an object." on the first line


protected void lov_room_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList lov_gvrack = (DropDownList)GridView1.FooterRow.FindControl("lov_gvrack");
string str = @"SELECT rack_no
FROM S01_M03_SpaceManagment_Rack
WHERE (room_no = '" + lov_room.SelectedValue.Trim() + "')";
cnn.DropDown3(lov_gvrack, str, "rack_no", "rack_no");
}



please any body solve my problem...
Thanks.
Posted
Updated 5-Nov-13 0:29am
v2
Comments
Tom Marvolo Riddle 5-Nov-13 2:49am    
Probably "lov_gvrack" is wrong
Gaurav Kumar Gaur 5-Nov-13 2:51am    
where....?
This is drop down id which is used in grid view.
ArunRajendra 5-Nov-13 2:59am    
This could be either GridView1 is null or FooterRow is null. GridView1 null is rare but re-verify. My suspect is on FooterRow. Try to confirm by debugging.
Gaurav Kumar Gaur 5-Nov-13 4:04am    
grid view1 is null and In the footer row of grid it contains ddl, radio botton etc when we fill ddl and add row then it will show in grid's header.
bt the problem is that value didn't insert in ddl.

1 solution

Fire up your debugger. Put a breakpoint on the problematic row. Check if
- GridView1 equals null
- GridView1.FooterRow equals null
- GridView1.FooterRow.lov_gvrack equals null
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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