By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,310 Members | 1,951 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,310 IT Pros & Developers. It's quick & easy.

Question about Data Binding

P: n/a
Hi there,

I found this question in Amit Kalani's preparation book for exam 70-15
(Developing Web Applications with C#). I think it's a very stupid question!
It says the correct answer is A but the explanation is not useful. Please
spend sometime reviewing this question and its answer.

Any guide on this matter would be greatly appreciated.

Question: Your Web form includes a DropDownList control named ddlStudent
that displays a list of students and a DataGrid control named dgCourses that
displays the courses that the selected student is enrolled in. When the page
is loaded, you run code that includes the lines:

// Load the data

When the user selects an entry in the DropDownList control, you create a
DataView object and then set the DataSource property of the DataGrid control
to the DataView object. You're receiving an error at page load. What is the
most likely cause of this error?

A. The DataBind() method for the page is attempting to bind data to the
DataGrid control as well as to the DropDownList control, and the data for
the DataGrid control does not exist yet.

B. The DropDownList control is marked as readonly.

C. There is no student information in the database.

D. The DataBind() method cannot be called in the Page_Load() event handler
because no data is available to the form in that event.

Answer: A. Calling the DataBind() method for the page will call the
DataBind() method for every control on the page as well, whether the data is
available or not.
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.