asp.net - UserAccounts_RowEditing/Updating is not working properly -


OK, so I have a gridview and added crying additives and rou updating, but it really is nothing I will edit it. It is my code for both:

  Protected Zero UserAccounts_RowEditing (Object Sender, GridViewEditEventArgs e) {UserAccounts.EditIndex = e.NewEditIndex; BindUserAccounts (); } Secure Zero UserAccounts_RowUpdating (Object Sender, GridViewUpdateEventArgs e) {int index = UserAccounts.EditIndex; GridViewRow line = UserAccounts.Rows [e.RowIndex]; Username = User Account Ro [e. Roidind] .cell [1]. Text; Email = ((Textbox) Line Seals [2]. Control [0]). Text; Membership User User = Membership User (username); If (user! = Null) {user.Email = email; Membership.UpdateUser (user); ActionStatus.Text = string.Format ("User {0} description has been updated successfully!", User name); } UserAccounts.EditIndex = -1; BindUserAccounts (); }  

What am I doing wrong here?

Edit: This is my BindUserAccounts:

  Private Zero BindUserAccounts () {Integer; UserAccounts.DataSource = Subscription FindUsersByName (this.UsernameTemplate + "%", this.Pindexx, this. PagesSize, Total Record Out); UserAccounts.DataBind (); Bull Visiting FirstPage = (this.PageIndex == 0); LnkFirst.Enabled =! Incoming firstpage; LnkPrev.Enabled =! Incoming firstpage; Int lastPageIndex = (total vacancies - 1) / this.PageSize; Bull Visiting LastPage = (this.PageIndex & gt; = Final Page Index); LnkNext.Enabled =! By visiting the previous page; LnkLast.Enabled =! By visiting the previous page; }  

I think it should be

  Protected Zero update_click_foredu (object sender, gridview update ee) {label edui = (label) edugrid.Rows [e.RowIndex] .FindControl ("label"); Text box unit = (text box) edugrid.Rows [e.RowIndex] .FindControl ("txtuni"); If (Unite! = Null & Constact! = Null & amp; StartedText! = Null End and Endatetectact! = Null) {Use (Entity 1 Contact = New Entity 1 ()) {string eduID = edui.Text; Model obj = context.entitytabel.First (x => x.id == eduID); Obj.Univ_Name = unitxt.Text; Context.SaveChanges (); LblMessage.Text = "Successfully Saved."; Edugrid.EditIndex = -1; Bindgrid (); }}}  

Here you can get control of the text box using EF and save it in gridview

Hope this helps you


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -