---
title: "Gridview RowUpdating Code bihind"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/144332-gridview-rowupdating-code-bihind"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "Bjuris"
published: "2006-03-22T09:29:44.000Z"
updated: "2006-03-22T09:29:44.000Z"
replies: 0
views: 1270
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/144332-gridview-rowupdating-code-bihind"
---

# Gridview RowUpdating Code bihind

## #1 — Bjuris, 2006-03-22T09:29Z

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.

Permalänk: https://www.webforum.nu/p/144332

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/144332-gridview-rowupdating-code-bihind
