Click here to Skip to main content
15,878,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,
When I click on edit link in grid, the row does not go to edit mode.

I paste my code:
Private Sub gvJobs_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvJobs.RowDataBound
Dim gvRow As GridViewRow
        Dim drw As DataRowView  'Stores the row to be updated
        drw = e.Row.DataItem
        gvRow = e.Row
        If e.Row.RowType = DataControlRowType.DataRow Then
            'If ((flag = True) AndAlso ((e.Row.RowState AndAlso DataControlRowState.Edit) > 0)) Then
            If ((flag = True) AndAlso ((e.Row.RowState = DataControlRowState.Edit))) Then
                'OrElse ((e.Row.RowState > 0) AndAlso (DataControlRowState.Edit > 0))

                Dim ddlGClient As DropDownList
                Dim ddlGBrandCategory As DropDownList
                Dim ddlGBrand As DropDownList
                Dim chkEActive As New CheckBox
                Dim ajaxCDD As CascadingDropDown
                Dim objDS As New DataSet
                Dim objDT As New DataTable

                ddlGClient = gvRow.FindControl("ddlClient")
                ddlGBrandCategory = gvRow.FindControl("ddlBrandCategory")
                ddlGBrand = gvRow.FindControl("ddlBrand")
                chkEActive = gvRow.FindControl("chkEActive")
                'ajaxCDD = gvRow.FindControl("CascadingDropDown1")
                If Not ddlGClient Is Nothing Then
                    ViewState.Add("ddlCategory", ddlGBrandCategory)
                    ViewState.Add("ddlBrand", ddlGBrand)
                End If

                If Not ddlGClient Is Nothing Then
                    'objDT = getDetails(1, 0, 0)
                    Fillclientdropdown(ddlGClient)
                    If drw(2).ToString() = "All" Then
                        ddlGClient.SelectedValue = drw(2).ToString()
                        ddlGBrandCategory.Items.Add(New ListItem("All", 0))
                        ddlGBrand.Items.Add(New ListItem("All", 0))
                        objDT.Dispose()
                    Else
                        ddlGClient.SelectedValue = AliaDAO.clsClientmasterDAO.GetClientid(drw(2).ToString())
                        'objDT = getDetails(2, ddlClient.SelectedValue, 0)
                        fillBrandCategorydropdown(ddlGClient.SelectedValue, ddlGBrandCategory)
                        If drw(3).ToString() = "All" Then
                            ddlGBrandCategory.SelectedValue = drw(3).ToString()
                            ddlGBrand.Items.Add(New ListItem("All", 0))
                        Else
                            ddlGBrandCategory.SelectedValue = AliaDAO.clsBrandCategoryDAO.GetBrandcategorid(drw(3).ToString())
                            fillbranddropdown(ddlGClient.SelectedValue, ddlGBrandCategory.SelectedValue, ddlGBrand)
                            If drw(4).ToString = "All" Then
                                ddlGBrand.SelectedValue = drw(4).ToString
                            Else
                                ddlGBrand.SelectedValue = AliaDAO.clsBrandDAO.GetBrandid(drw(4).ToString)
                            End If
                        End If
                    End If
                End If
If Not chkEActive Is Nothing Then
                    If drw(6) = "True" Then
                        chkEActive.Checked = True
                    Else
                        chkEActive.Checked = False
                    End If
                End If
            Else
                Dim chkActive As New CheckBox
                Dim hfAvtive As New HiddenField
                Dim lnkDelete As New LinkButton
                chkActive = gvRow.FindControl("chkActive")
                hfAvtive = gvRow.FindControl("hfActive")
                lnkDelete = gvRow.FindControl("lnkDelete")
                If Not chkActive Is Nothing Then
                    If hfAvtive.Value = "True" Then
                        chkActive.Checked = True
                    Else
                        chkActive.Checked = False
                    End If
                End If
                Dim intID As Integer = lnkDelete.CommandArgument
                lnkDelete.Attributes.Add("onclick", "return funDelete(" & intID & "," & e.Row.RowIndex & ");")
            End If
        End If
    End Sub


In rowdatabound the code gets execute, but the gird does not go to edit mode
I have made use of EditItemTemplate to hold controls which is used for editing
but this control is not getting displayed while editing

And when I click edit link, for every row the event is called twice.

Any idea, where I'm going wrong

Thanks in Advance
Posted
Updated 14-Jul-11 0:15am
v2

1 solution

You must be doing something wrong.
Check this http://msdn.microsoft.com/en-us/library/ms972948.aspx[^]
 
Share this answer
 
Comments
dhage.prashant01 14-Jul-11 6:15am    
I have pasted my rowdatabound event code
tell me where is wrong
Prerak Patel 14-Jul-11 6:59am    
And who said that it is enough to understand the problem? And why are you using RowDataBound anyway?
dhage.prashant01 14-Jul-11 7:10am    
Because in that event I'm filling the dropdowns
I'm trying cascading dropdown in grid

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900