image button error: System.ArgumentException: Invalid postback or callback argument
<p>In the grid view I have uploaded files with image icon. For having image icon in the grid view and getting type of uploaded file in the row (command Argument), I have used image button, it shows the image icon but when I click on the image button, I have error" System.ArgumentException: Invalid postback or callback argument"
If I could use image control instead of image button for me was better, but I do not know how to get extension file type from row.
Also if we could disable link image button in this case, was no problem.</p>

<p><strong>Desin of database for tblfile is like below:</strong></p>

<pre><code>Fileid(int)
Docid(int)
TransId(int)
Content type varchar(75)
Data varbinary(max)
Extention varchar(50)
</code></pre>

<p><strong>Cs:</strong></p>

<pre><code>protected void GridViewEfile_DataBound(object sender, EventArgs e)
 {
    foreach (GridViewRow gvr in GridViewEfile.Rows)                   //loop each row
    {
        ImageButton ib = (ImageButton)gvr.FindControl("ib1");    //find imagebutton

        string exten = ib.CommandArgument;;      //get index of '.'
        if (exten == ".pdf")
            ib.ImageUrl = @"~/Images/iconpdf.gif";                      //set image for imagebutton in each row

        else if (exten == ".docx")

            ib.ImageUrl = @"~/Images/icondoc.gif";

    }
}

protected void ib1_Command(object sender, CommandEventArgs e)
{

       _DataContext = new EDMSDataContext();
       //you can get your command argument values as follows
       string FileId = e.CommandName.ToString();
       int _FileId = Convert.ToInt32(FileId);
       tblFile Efile = (from ef in _DataContext.tblFiles
                        where ef.FileId == _FileId
                        select ef).Single();
       if (Efile != null)
       {

           download(Efile);

       }
   }
</code></pre>

<p><strong>.aspx:</strong></p>

<pre><code>&lt;asp:GridView ID="GridViewEfile" runat="server" AutoGenerateColumns="False" CellPadding="4"
    OnDataBound="GridViewEfile_DataBound" ForeColor="Black" DataKeyNames="FileID"
    GridLines="None" ShowHeader="False"&gt;
    &lt;AlternatingRowStyle BackColor="Yellow" /&gt;
    &lt;Columns&gt;
        &lt;asp:TemplateField&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:ImageButton runat="server" ID="ib1" OnCommand="ib1_Command" CommandName='&lt;%#Eval("FileID")%&gt;'
                    CommandArgument='&lt;%# Eval("Exten") %&gt;' /&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
        &lt;asp:TemplateField&gt;
            &lt;ItemTemplate&gt;
                &lt;asp:LinkButton ID="LinkButton1" runat="server" OnCommand="LinkButton1_Command" CommandName="Download"
                CommandArgument='&lt;%#Eval("FileID")%&gt;'&gt;&lt;%#Eval("FileName")%&gt;&lt;/asp:LinkButton&gt;
            &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
        &lt;asp:BoundField DataField="ContentType" /&gt;
    &lt;/Columns&gt;
    &lt;EditRowStyle BackColor="#7C6F57" /&gt;
    &lt;FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /&gt;
    &lt;HeaderStyle BackColor="Red" Font-Bold="True" ForeColor="White" /&gt;
    &lt;PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" /&gt;
   &lt;RowStyle BackColor="#E3EAEB" /&gt;
   &lt;SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" /&gt;
&lt;/asp:GridView&gt;
</code></pre>
