Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gridview cell value in edit more

Status
Not open for further replies.

sakkara

Programmer
Jun 18, 2007
4
AU
Hi,

I am trying to manually edit a gridview and get the updated values. The values will then be passed to tbe middle tier. Due to this, I am manually setting up the data source and binding it. My code binds the data correctly, displays it and so on, but when I actually edit any columns and click Update, I can not see that the values are in the columns.

Any ideas???

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
BindData()
End Sub

Private Sub BindData()
Dim BindData As DataSet

BindData = UserContext.Controller.SelectAllRoles
gvRoles.DataSource = BindData

gvRoles.DataBind()
End Sub

Private Sub gvRoles_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvRoles.PageIndexChanging
gvRoles.PageIndex = e.NewPageIndex
gvRoles.DataBind()
End Sub

Private Sub gvRoles_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gvRoles.RowEditing
gvRoles.EditIndex = e.NewEditIndex

DataBind()
End Sub

Private Sub gvRoles_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvRoles.RowUpdating
'UserContext.Controller.UpdateRole(RoleID:=a, RoleName:=b, RoleDescription:=c, Status:=0)
gvRoles.EditIndex = -1
DataBind()
End Sub

Private Sub gvRoles_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles gvRoles.RowCancelingEdit
gvRoles.EditIndex = -1
DataBind()
End Sub
 
Thank you for your quick reply!

If I only databind when the postback is true, then nothing will ever display on the gridview, it needs to at least bind once on the first hit. Any other ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top