The exception is always thrown at the following statement..:
protected void DataList2_SelectedIndexChanged(object sender, EventArgs e)
{
x= should get the primary key of the item selected from a datalist
Server.Transfer("AnswerQuestion.aspx?x=" + int.Parse(DataList2.DataKeyField) + "&question=" +"bla bla") + "&time=" + DateTime.Now);
}
It throws exception here..:( even when i seperate it
int threadID = int.Parse(DataList1.DataKeyField.ToString());
Why?
Well, I strongly suspect it was this call:
That suggests
DataList2.DataKeyFieldisn’t a valid string representation of an integer in the current locale. (As an aside, you should probably be doing this formatting and possibly parsing usingCultureInfo.InvariantCulture. Only user input should be treated using the user’s culture.)