In my datagrid I have a column that appears as a <asp:hyperlinkcolumn..> but when the user goes into Edit mode I want the field to change to a textbox to allow the user to change the "name" of the record...
here's my asp html
Code:
<asp:DataGrid id="dgQuiz" runat="server" datakeyfield="IDP" OnEditCommand="dgQuiz_Edit" OnCancelCommand="dgQuiz_Cancel" OnUpdateCommand="dgQuiz_Update" AutoGenerateColumns="False" Width="560px" cssclass="data">
<columns>
<asp:templatecolumn headertext="Quiz">
<itemtemplate>
<asp:hyperlink id="lnkQuiz" navigateurl='QuizQuestions.aspx?TestIDP=<%# DataBinder.Eval(Container, "DataItem.IDP") %>' runat="server"></asp:hyperlink>
</itemtemplate>
<edititemtemplate>
<asp:textbox id="txtQuiz" runat="server"></asp:textbox>
</edititemtemplate>
</asp:templatecolumn>
<asp:hyperlinkcolumn target="_self" datanavigateurlfield="IDP" datanavigateurlformatstring="QuizQuestions.aspx?TestIDP={0}" datatextfield="Name" headertext="Quiz"></asp:hyperlinkcolumn>
<asp:EditCommandColumn EditText="Edit" CancelText="Cancel" UpdateText="Update" ItemStyle-Wrap="false" HeaderText="Edit" HeaderStyle-Wrap="false" headerstyle-cssclass="headRow" itemstyle-cssclass="editField" />
</Columns>
The code for the <asp:hyperlinkcolumn...> at the bottom works as expected, it creates a hyperlink to the correct page with the IDP param. BUT the template column above it creates a hyperlink with the
<%# DataBinder...%> as the href TEXT (not rendered as the value)...
Like: <a href="QuizQuestions.aspx?TestIDP=<%# DataBinder.Eval(Container, "DataItem.IDP") %>"...WRONG
Instead of: <a href="QuizQuestions.aspx?TestIDP=3"...CORRECT
???
I tried putting the <asp:hyperlinkcolumn...> inside of the templatecolumn but it says "The active schema does not support the element <asp:hyperlinkcolumn...>"
???
-------------------------
Beware of programmers with screwdrivers...