Last post Nov 22, 2010 01:18 PM by tmmycat
Nov 22, 2010 09:53 AM|tmmycat|LINK
I have a question, is there a "standard" way to access the current data item in the codebehind of a dynamic data page that has the ID in the querystring? (I could get the ID from the querystring and look it up manually but I'm just wondering if there's a
built-in function for it so I don't hit the database again for something that's already been looked up?)
I'm customizing Details.aspx so that it shows some child records in addition to the fields on the current record. (It's a response to a survey - I'm adding the list of questions with the answer for each question.)
I tried something like this but I got an error, Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
protected void Page_Load(object sender, EventArgs e)
QuestionListUserControl questions = UpdatePanel1.FindControl("QuestionList") as QuestionListUserControl;
questions.DataSource = (GetDataItem() as SurveyResponse).SurveyResponseAnswers;
Thank you in advance :)
Nov 22, 2010 11:00 AM|sjnaughton|LINK
Hi Tmmycat, you cannot get access to the current value excep in OnDataBound event then you call GetDataItem() method on the page to get the current value.
Dynamic Data 4
Nov 22, 2010 01:18 PM|tmmycat|LINK
Makes sense ... thank you!!