editcommandcolumn not working with template

T

tshad

I have a row like this that works fine:

***************************************************************
<asp:DataGrid visible="False"
border=1
id="DataGrid1"
runat="server"
Width="400px"
Height="79px"
AutoGenerateColumns="False"
GridLines="None"
onEditCommand="DataEdit"
onCancelCommand="DataCancel"
onUpdateCommand="DataUpdate">
<AlternatingItemStyle BorderWidth="0px" BorderStyle="None"
BorderColor="White" BackColor="#ccccff"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True"
BackColor="#6699cc"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="Answer"
HeaderText="Answer"></asp:BoundColumn>
<asp:BoundColumn DataField="PositionID" visible="false"
ReadOnly="true" HeaderText="PositionID"></asp:BoundColumn>
<asp:BoundColumn DataField="QuestionUnique"
visible="false" ReadOnly="true"
HeaderText="QuestionUnique"></asp:BoundColumn>
<asp:BoundColumn DataField="AnswerUnique" visible="false"
ReadOnly="true" HeaderText="AnswerUnique"></asp:BoundColumn>
<asp:EditCommandColumn EditText="<img
src='..\images\Edit.png'border='0' id='textbox1'>" visible="true"
ButtonType="LinkButton"
UpdateText="<img src='..\images\update.png'
border='0'>" CancelText="<img src='..\images\Cancel.png' border='0'>" />
</Columns>
</asp:DataGrid>
**********************************************************************************
With this I get a text box in the "Answer" column and in the correct row.
If I only change the first bound column to a template:

***********************************************************************************
<Columns>
<asp:TemplateColumn HeaderText="Answer">
<ItemTemplate>
<asp:Label id="lblAnswer" runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Answer") %>'>
</asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox id="txtAnswer"
runat="server"></asp:TextBox>
</FooterTemplate>
</asp:templateColumn>
<asp:BoundColumn DataField="PositionID" visible="false"
ReadOnly="true" HeaderText="PositionID"></asp:BoundColumn>
******************************************************************************

I don't get the text box anymore. I am using this to allow my to set up an
insert row in the footer.

Is there something I need to do special to a template to work with the
editcommandcolumn?

Thanks,

Tom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top