Accesing Label.text in DataList
Posted
by
Itay Gurvich
on Stack Overflow
See other posts from Stack Overflow
or by Itay Gurvich
Published on 2012-06-02T10:36:33Z
Indexed on
2012/06/02
10:41 UTC
Read the original article
Hit count: 223
datalist
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?
© Stack Overflow or respective owner