Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 18th, 2005, 10:02 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default Datagrid Templatecolumn with Hyperlink

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...
__________________
-------------------------
Beware of programmers with screwdrivers...





Similar Threads
Thread Thread Starter Forum Replies Last Post
hyperlink in a datagrid? bhavna General .NET 1 January 25th, 2007 12:37 PM
DataGrid Hyperlink maddy137 ASP.NET 1.0 and 1.1 Professional 1 August 29th, 2006 07:18 AM
DataGrid hyperlink Tangerine ASP.NET 1.x and 2.0 Application Design 2 March 24th, 2004 01:04 AM
Creating a Hyperlink in a datagrid aadz5 ASP.NET 1.0 and 1.1 Basics 0 October 25th, 2003 07:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.