多做题,通过考试没问题!

微软认证考试

睦霖题库>其他计算机考试>微软认证考试

You create a Web Form. The Web Form uses the FormView control to enable a user to edit a record in the database. When the user clicks the Update button on the FormView control, the application must validate that the user has entered data in all of the fields. You need to ensure that the Web Form does not update if the user has not entered data in all of the fields. Which code segment should you use? ()

  • A、Protected Sub FormView1_ItemUpdating(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.FormViewUpdateEventArgs) _ Handles FormView1.ItemUpdating Dim entry As DictionaryEntry For Each entry In e.Keys If entry.Value.ToString() = System.String.Empty Then e.Cancel = True Return End If Next entryEnd Sub
  • B、Protected Sub FormView1_ItemUpdated(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.FormViewUpdatedEventArgs) _ Handles FormView1.ItemUpdated Dim entry As DictionaryEntry For Each entry In e.NewValues If entry.Value.Equals("") Then e.KeepInEditMode = True Return End If Next entryEnd Sub
  • C、Protected Sub FormView1_ItemUpdating(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.FormViewUpdateEventArgs) _ Handles FormView1.ItemUpdating Dim entry As DictionaryEntry For Each entry In e.NewValues If entry.Value.Equals("") Then e.Cancel = True Return End If Next entryEnd Sub
  • D、Protected Sub FormView1_ItemUpdated(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.FormViewUpdatedEventArgs) _ Handles FormView1.ItemUpdated Dim entry As DictionaryEntry For Each entry In e.Keys If entry.Value.ToString() = System.String.Empty Then e.KeepInEditMode = True Return End If Next entryEnd Sub
正确答案:C
答案解析:
进入题库查看解析

微信扫一扫手机做题