试题详情
单项选择题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、protectedvoidFormView1_ItemUpdating(objectsender,FormViewUpdateEventArgse){foreach(DictionaryEntryentryine.Keys){if(entry.Value.ToString()==System.String.Empty){e.Cancel=true;return;}}}

B、protectedvoidFormView1_ItemUpdated(objectsender,FormViewUpdateEventArgse){foreach(DictionaryEntryentryine.NewKeys){if(entry.Value.Equals(“”)){e.KeepEditMode=true;return;}}}

C、protectedvoidFormView1_ItemUpdating(objectsender,FormViewUpdateEventArgse){foreach(DictionaryEntryentryine.NewValues){if(entry.Value.Equals(“”)){e.Cancel=true;return;}}}

D、protectedvoidFormView1_ItemUpdating(objectsender,FormViewUpdateEventArgse){foreach(DictionaryEntryentryine.Keys){if(entry.Value.ToString()==System.String.Empty){e.KeepInEditMode=true;return;}}}

  • C
  • 关注下方微信公众号,在线模考后查看

热门试题