Accesing Label.text in DataList
- by Itay Gurvich
So im trying to access informtaion from a label inside the DataList by pressing a button inside it. I put a code in thusly:
protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)
{
Character character = (Character)Session["character"];
Label lbl = (Label)DataList1.SelectedItem.FindControl("lblName");
int SkillID = int.Parse(DAL.ExecuteScalar("SELECT SkillID FROM skills WHERE SkillName = '" + lbl.ToString() + "'").ToString());
DAL.ExecuteNonQuery("INSERT INTO AssignedSkills (Offensive) Values ('" + SkillID.ToString() + "') WHERE CharID = '" + character.get_name().ToString() + "'");
}
when i press the button its not even getting there and im getting an error "Invalid postback or callback argument."
how can i access it?