code_junkie

binding dropdownlist in repeater's item template using an sql datasource

Nov 12th, 2011
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. partial class MyPage
  2. {
  3. private DataTable _ddlData;
  4.  
  5. protected void Page_Load(object sender, EventArgs e)
  6. {
  7. //Logic to fill _ddlData and then bind the repeater goes here
  8. }
  9.  
  10. protected void Grid_ItemDataBound() //I forgot the proper parameters here
  11. {
  12. //Properly check for e.item.itemtype = Item or Alt item
  13. DropDownList oList = (DropDownList)e.item.findcontrol("ddlItems"); //lookup for your item
  14. oList.DataSource = _ddlData;
  15. oList.DataBind();
  16. }
  17. }
Add Comment
Please, Sign In to add comment