Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalid postback or callback argument. what is the issue with this code?
    primarykey
    data
    text
    <p>I have this gridview and i don't know what is the problem with the buttons inside it. I have this asp code:</p> <pre><code>&lt;asp:GridView ID="gvList" runat="server"&gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText="User Name" HeaderStyle-ForeColor="Black" HeaderStyle-Font-Bold="true"&gt; &lt;ItemTemplate&gt; &lt;asp:Label runat="server" ID="lblUsername" Text='&lt;%# Eval("cUserName") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText="Dept User" HeaderStyle-ForeColor="Black" HeaderStyle-Font-Bold="true"&gt; &lt;ItemTemplate&gt; &lt;asp:Label runat="server" ID="lblDept" Text='&lt;%# iif(Eval("lDeptUser"),"Yes","No") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText="Actions" HeaderStyle-ForeColor="black" HeaderStyle-Font-Bold="true"&gt; &lt;ItemTemplate&gt; &lt;asp:Button ID="btnedit" runat="server" Text="Edit" /&gt; &lt;asp:Button ID="btnDelete" OnClick="DeleteRow" runat="server" Text="Delete" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p>And when i press delete or edit on any row it gives me error!! <code>Invalid postback or callback argument.</code></p> <p>This is my server side code in vb.net:</p> <pre><code>Public Function GetList() As DataTable Dim Query As String = "Select cUserName,lDeptUser FROM Intranet.dbo.Gn_ISCoordinators" Dim dt As DataTable = New DataTable() Using adapter = New SqlDataAdapter(Query, ConfigurationManager.ConnectionStrings("IntranetConnectionString").ConnectionString) adapter.Fill(dt) gvList.DataSource = dt gvList.DataBind() Return dt End Using End Function Public Function DelRow() As DataTable Dim strusername As String = CType(gvList.FindControl("lblUsername"), Label).Text.Trim() Dim Query As String = "Delete FROM Intranet.dbo.Gn_ISCoordinators where cUserName='" &amp; strusername &amp; "'" Dim dt As DataTable = New DataTable() Using Adapter = New SqlDataAdapter(Query, ConfigurationManager.ConnectionStrings("IntranetConnectionString").ConnectionString) Adapter.Fill(dt) Return dt End Using End Function Protected Sub DeleteRow(ByVal sender As Object, ByVal e As System.EventArgs) DelRow() End Sub Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load GetList() End Sub Protected Sub gv(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvList.RowDataBound e.Row.Cells(3).Visible = False e.Row.Cells(4).Visible = False End Sub End Class </code></pre> <p>I think that its from the client side. Please help me with this problem. btw i am not using any ajaxtoolkit till now and the <code>EnableEventValidation="true"</code> in the page as well as the web.config</p> <p>What is the problem and its solution, please help me.</p> <p>thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload