Which code segment should you use?

You are implementing a read-only page that includes the following controls. You disable view state
to improve performance. You need to ensure that the page is updated to display the latest data
when the user clicks the refresh button. Which code segment should you use?

You are implementing a read-only page that includes the following controls. You disable view state
to improve performance. You need to ensure that the page is updated to display the latest data
when the user clicks the refresh button. Which code segment should you use?

A.
protected void Page_PreInit(object sender, EventArgs e)
{
if (!IsPostBack)
{
gvCustomers.DataSource = GetCustomers();
gvCustomers.DataBind();
}}

B.
protected void Page_Load(object sender, EventArgs e)
{
gvCustomers.DataSource = GetCustomers();
gvCustomers.DataBind();
}

C.
protected void gvCustomers_DataBinding(object sender, EventArgs e)
{
gvCustomers.DataSource = GetCustomers();
gvCustomers.DataBind();
}

D.
protected void Page_PreRender(object sender, EventArgs e)
{
if (!IsPostBack)
{
gvCustomers.DataSource = GetCustomers();
gvCustomers.DataBind();
}}



Leave a Reply 0

Your email address will not be published. Required fields are marked *