<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" style="text-align: center" Width="100%" DataKeyNames="ID_Specialized" onrowcommand="GridView1_RowCommand" > <alternatingrowstyle backcolor="White" forecolor="#284775" /> <columns> <asp:DynamicField DataField="Specialized_Name" HeaderText="name" /> <asp:DynamicField DataField="Degree" HeaderText="grade" /> <asp:DynamicField DataField="current_work" HeaderText="current work" /> <asp:TemplateField ShowHeader="False"> <itemtemplate> <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandArgument='<%# Eval("ID_Specialized") %>' CommandName="Select" ImageUrl="~/images/newsletter_emailtemplate.gif" oncommand="ImageButton1_Command" Text="Select" /> </itemtemplate> </columns> <HeaderStyle Font-Bold="True" ForeColor="#5D7B9D" CssClass="txt22" /> <pagerstyle backcolor="#284775" forecolor="White" horizontalalign="Center" /> <rowstyle backcolor="#F7F6F3" forecolor="#333333" cssclass="txt2" /> <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <sortedascendingcellstyle backcolor="#E9E7E2" /> <sortedascendingheaderstyle backcolor="#506C8C" /> <sorteddescendingcellstyle backcolor="#FFFDF8" /> <sorteddescendingheaderstyle backcolor="#6F8DAE" /> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ContinueConnectionString %>" SelectCommand="SELECT * FROM [Specialized]"> <td removed="./css_files/r.gif"> </td> <tr> <td> <img src="./css_files/d-l.gif" width="8" height="9"></td> <td removed="./css_files/d.gif" colspan="2"> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ContinueConnectionString %>" SelectCommand="SELECT * FROM [Specialized]">
Quote:For me, it turns out that in my grid view, the columns were bound as an "asp:DynamicField", not as a "asp:BoundField" ie changing my columns from something like so: <columns> <asp:dynamicfield datafield="Id" headertext="Id" xmlns:asp="#unknown"> to this: <columns> <asp:boundfield datafield="Id" headertext="Id" xmlns:asp="#unknown"> fixed it ;-)
<Columns> <asp:DynamicField DataField="Id" HeaderText="Id" /> </Columns>
<pre lang="c#"><Columns> <asp:BoundField DataField="Id" HeaderText="Id" /> </Columns>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)