本文介绍了网格行不进入编辑模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,
当我单击网格中的编辑链接时,该行不会进入编辑模式.
我粘贴了我的代码:
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
在rowdatabound中,代码得到执行,但网格未进入编辑模式
我已经使用EditItemTemplate来保存用于编辑的控件
但在编辑时不会显示此控件
当我单击编辑"链接时,对于每一行,该事件都会被调用两次.
任何想法,我要去哪里哪里
在Advance中致谢
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
推荐答案
这篇关于网格行不进入编辑模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!