AspdotnetCodes.com
US and UK Data Centers – DiscountASP.NET
 
Articles Subscribe for our Articles Updates
Books
Resources
Downloads
Free Tech Magazines
Archives
Softwares
Newsletter
Suggest Us
Link to Us
 about gridview
Posted by subhranshu on  4/1/2008 5:49:19 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
  
i have some other problems in datagrid. in my gridview i have to add dropdownlist in every rows. and in every rows the dropdown datas are coming from master tables(foreign key tables).so i am getting confused how to solve this problem.please help me it is urgent.

Post Answer Post New Question

 Viewer's Answers
Fill the DropDown box in OnRowDataBound event
Posted By Moderator1 on 4/1/2008 8:27:12 PM
Description:
Hi,

I suggest you to fill the Master's Table Dropdown list box in OnRowDataBound event.
Step 1: Find the control
DropDownList DropDownList1 = (DropDownList)e.Row.Cells[0].FindControl("DropDownList1");
DropDownList1.DataSource = your_DataTable_Filled_with_Master_Info
DropDownList1.DataBind()

That's it. for the DataTable pass conditions based on the Foreign Reference Key.

Good Luck..
 
Sponsored by