Object reference error in Master Page
I am getting the following error at runtime:
"Object reference not set to an instance of an object." - the code in question in my code-behind is as follows:
Dim MinDateDataView As DataView = CType(SqlMinDate.Select(DataSourceSelectArguments.Empty), DataView)
Dim MinDateDataRowView As DataRowView = MinDateDataView.Item(0)
This is only a proble开发者_C百科m when it's used in a master page. Can anyone help me out? Thanks
Have you perform SqlMinDate.DataBind() for the SqlDataSource?
<SelectParameters>
<asp:FormParameter FormField="ctl00$MainContent$txtSubID" Name="SubID" Type="Int32" />
</SelectParameters>
Checking the html source I've used the master page control name, and it's worked. Just came back to it after leaving it for a while, as is often the case.
精彩评论