PrepAway - Latest Free Exam Questions & Answers

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?

PrepAway - Latest Free Exam Questions & Answers

A.
Private Sub Page_PreInit(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.PreInit
If Not IsPostBack Then
gvCustomers.DataSource = GetCustomers()
gvCustomers.DataBind()
End If
End Sub

B.
Protected Sub Page_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.Load
gvCustomers.DataSource = GetCustomers()
gvCustomers.DataBind()
End Sub

C.
Private Sub gvCustomers_DataBinding(ByVal sender As Object,
ByVal e As System.EventArgs) Handles gvCustomers.DataBinding
gvCustomers.DataSource = GetCustomers()
gvCustomers.DataBind()
End Sub

D.
Private Sub Page_PreRender(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.PreRender
If Not IsPostBack Then
gvCustomers.DataSource = GetCustomers()
gvCustomers.DataBind()
End If
End Sub


Leave a Reply