Jag försöker mig på att uppdatera en gridview via code behind utan att ha med en massa sqldatasource (update, delete) i min aspx fil.
protected void GridViewAnnonser_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = GridViewAnnonser.Rows[e.RowIndex];
Label AnnonsID = row.FindControl("lblIDEdit") as Label;
DropDownList AnnonsTyp = row.FindControl("drpAnnonsTyp") as DropDownList;
TextBox Omrade = row.FindControl("txtOmrade") as TextBox;
TextBox Kategori = row.FindControl("txtKategori") as TextBox;
TextBox Namn = row.FindControl("txtNamn") as TextBox;
TextBox Beskrivning = row.FindControl("txtBeskrivning") as TextBox;
UpdateGridViewAnnonser(AnnonsID.Text, AnnonsTyp.SelectedValue, Omrade.Text, Kategori.Text, Namn.Text, Beskrivning.Text);
GridViewAnnonser.EditIndex = -1;
BindGridViewAnnonser("");
}
Om jag kören response.write på ex kategori så finns inte det nya värdet med utan det är det gamla värdet från databasen.
Någon som vet vad jag gör för fel?
edt. skall påpeka att värdena jag hämtar in är från aspx sidans <EditItemTemplate> sketion.