我正在使用一個GridView,並且我在編輯鏈接中遇到了兩次點擊來查看編輯字段問題。在建議之後,我再次在.RowEditing處理程序上綁定我的GridView。問題依然存在,我只在第二次點擊任何編輯鏈接後纔看到編輯字段。Gridview編輯,點擊兩次問題
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Default.aspx.vb" Inherits="GridViewTest._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Welcome to ASP.NET!
</h2>
<p>
To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>.
<asp:GridView ID="gvReport" runat="server" AutoGenerateColumns="False"
AutoGenerateEditButton="True">
<Columns>
<asp:BoundField DataField="c1" HeaderText="C1" />
<asp:BoundField DataField="c2" HeaderText="C2" />
<asp:BoundField DataField="c3" HeaderText="C3" />
<asp:BoundField DataField="c4" HeaderText="C4" />
<asp:BoundField DataField="c5" HeaderText="C5" />
<asp:BoundField DataField="c6" HeaderText="C6" />
<asp:BoundField DataField="c7" HeaderText="C7" />
<asp:BoundField DataField="c8" HeaderText="C8" />
</Columns>
</asp:GridView>
</p>
<p>
You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&clcid=0x409"
title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
</p>
</asp:Content>
Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
loaddata()
End If
End Sub
Sub loaddata()
'Get dataview dvAgTarRet_gv
gvReport.DataSource = dvAgTarRet_gv
gvReport.DataBind()
Session.Add("gvReport", dvAgTarRet_gv)
end sub
您需要背後張貼你的代碼來說明你是如何數據綁定。這聽起來像是你不恰當地將數據綁定到了gridview並且失去了viewstate,因此這個事件不能和原來的控制狀態相關聯。如果頁面不處於使用Page.Postback的回發模式,則嘗試僅綁定。 – 2011-03-25 14:30:38
Brian,好吧,我現在有一個空的.RowEditing處理程序。並在點擊編輯後,導致回發我沒有看到任何文本框/頁面更改? – fran 2011-03-25 14:49:07
fran,您需要發佈您的代碼/標記進行審查。 – 2011-03-25 15:38:45