Advertisement
Guest User

Untitled

a guest
Jul 26th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <asp:DropDownList ID="userDropDown" runat="server" DataTextField="CustomerName" DataValueField="CustomerId">
  2. </asp:DropDownList>
  3.  
  4. protected void Button1_Click(object sender, EventArgs e)
  5. {
  6. if(!page.isPostBack)
  7. {
  8. userDropDown.DataSource = CC.GetCustomers();
  9. userDropDown.DataBind();
  10. }
  11. }
  12.  
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!Page.IsPostBack)
  16. {
  17. //bind your datasource here (something like below)
  18. userDropDown.DataSource = GetCustomers();
  19. userDropDown.DataBind();
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement