protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string[] tipPercent = { "Ten Percent", "Fifteen Percent", "Twenty Percent", "Other" }; TipPercentsRadioButtonList.DataSource = tipPercent; TipPercentsRadioButtonList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string[] percents = { "10%", "15%", "20%", "Other" }; TipPercentsRadioButtonList.DataSource = percents; TipPercentsRadioButtonList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) /// IsPostBack will retain information by only drawing the code below on the first draw and not on subsequent passes { string[] tipPercent = { "Ten Percent", "FIfteen Percent", "Twenty Percent", "Other" }; TipPercentsRadioButtonList.DataSource = tipPercent; TipPercentsRadioButtonList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack)/*to the browser remember my choises when reload*/ { string[] percents = { "10%", "15%", "20%", "Other" }; TipPercentsRadioButtonList.DataSource = percents; TipPercentsRadioButtonList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack)/* meaning if this is a redraw of a page save the information*/ { string[] tipPercent = { "Ten Percent", "Fifteen Percent", "Twenty Percent", "Other" }; TipPercentsRadioButtonList.DataSource = tipPercent; TipPercentsRadioButtonList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) //First draw of page or redraw (preserves information) { string[] tipPercent = { "Ten Percent", "Fiftenn Percent", "Twenty Percent", "Other" }; TipPercentsRadioButtonList.DataSource = tipPercent; TipPercentsRadioButtonList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // If this is the firat draw of the page, do this. But don't redraw the page. if (!IsPostBack) { string[] tipPercent = { "Ten Percent", "Fifteen Percent", "Twenty Percent", "Other" }; TipPercentsRadioButtonList.DataSource = tipPercent; TipPercentsRadioButtonList.DataBind(); } }