• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 499
  • Last Modified:

Datagrid Update command will not fire

Hi,

I've got a small issue with a datagrid update command which will not fire.
In the datagrid there is a button column with Edit, Update, Cancel.
Edit and Cancel command fire well but the Update won't go......
Adding breakpoints shows that it won't go to the command.

HTML part
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>

example Cancel command works well
    Private Sub DataGrid1_CancelCommand(ByVal source As Object, _
   ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _
   Handles DataGrid1.CancelCommand
        DataGrid1.EditItemIndex = -1
        GetAdder()
    End Sub

Code Update command which won't fire
 Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand

        ' Get the selected ID
        Dim Sel_itm_id As String = CType(e.Item.FindControl("Label6"), Label).Text
       etc
       etc

It's the same basic code used for other datagrids on other pages and there it works well.
What could be the issue here ?

Thanks,
Ronald
0
RonaldZaal
Asked:
RonaldZaal
  • 5
2 Solutions
 
vinodhsomasekharanCommented:
Hi,

can u pls. clarify,

1.does hitting the update command in grid causes a post back?
2.is the name of the datagrid "Datagrid1"?

regards,
vinu
0
 
RonaldZaalAuthor Commented:
Hi,

1. no
2. yes,  ( great name huh  :-)  )

regs,
Ronald
0
 
RonaldZaalAuthor Commented:
hi again,

Well, actually, 1. Yes, it fires but not to the update command.
sorry for the confusion.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SandeepRRCommented:
Hi RonaldZaal,
IF u can check the entry for update command event handler in "InitializeComponent" method in code behind,
it should be there and must have sytax like this,

this.DataGrid1.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_UpdateCommand);----check this specially



SandeepRR

0
 
RonaldZaalAuthor Commented:
Hi SandeepRR,

In the Initialize component I just got
    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
 
    Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

The command event handler as you specify isn't there but it is also not there on other pages with the samsort of datagrid with the same button column where all commands work well.
I've got about 10 pages with the more or less the same setup but only this on refuses to fire the update command.
0
 
RonaldZaalAuthor Commented:
Isn't this a strange thingy........ seems to be a bigger prob then I thought....  or is it a bug...  or me ?

Just a small sub q...  A lightning bolt for Events - properties.....  Is this a visual studio 2005 thing ? Or is it .... me again.

Thanks,
Ronald
0
 
RonaldZaalAuthor Commented:
Ai Ai Ai.......
This is not good for my selfesteem....
I had RequiredFieldValidators on the page........
So they kept the page" as it was ".....
Nice to cut in my own fingers  :-)

And regarding the thingy with the lightning bolt, I found that this is VS2005. I really have to upgrade or drink more coffee.

Thanks all for replying!
regs,
Ronald
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now