R
Randall Parker
I have this element in an asp
ataGrid:
<asp:TemplateColumn HeaderText="Edit Record Button">
<ItemTemplate>
<asp:Button ID='<%# "Edit" + DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
CommandName="EquipmentEdit"
CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
Runat="server"
Text='<%# "Edit " + DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
/>
</ItemTemplate>
</asp:TemplateColumn>
I get this error when I try to view the page and I do not understand why the
expression I'm using to build the ID is not accepted:
Parser Error Message: '<%# "Edit" + DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>' is not a valid identifier.
Source Error:
Line 21: <asp:TemplateColumn HeaderText="Edit Record Button">
Line 22: <ItemTemplate>
Line 23: <asp:Button ID='<%# "Edit" + DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
Line 24: CommandName="EquipmentEdit"
Line 25: CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
How to do this? I just want a button in a grid cell that the user can click on.
If I do not try to make the ID unique then I get a different error when I go to click
on a button in the grid:
Multiple controls with the same ID 'hyperlink1' were found. FindControl requires that
controls have unique IDs.
<asp:TemplateColumn HeaderText="Edit Record Button">
<ItemTemplate>
<asp:Button ID='<%# "Edit" + DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
CommandName="EquipmentEdit"
CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
Runat="server"
Text='<%# "Edit " + DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
/>
</ItemTemplate>
</asp:TemplateColumn>
I get this error when I try to view the page and I do not understand why the
expression I'm using to build the ID is not accepted:
Parser Error Message: '<%# "Edit" + DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>' is not a valid identifier.
Source Error:
Line 21: <asp:TemplateColumn HeaderText="Edit Record Button">
Line 22: <ItemTemplate>
Line 23: <asp:Button ID='<%# "Edit" + DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
Line 24: CommandName="EquipmentEdit"
Line 25: CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.owner_serial_num") %>'
How to do this? I just want a button in a grid cell that the user can click on.
If I do not try to make the ID unique then I get a different error when I go to click
on a button in the grid:
Multiple controls with the same ID 'hyperlink1' were found. FindControl requires that
controls have unique IDs.