Put datalist in editmode when page loads

J

J 2 the B

I need to show a datalist in edit mode right when the page loads.

I've tried this, but nothing shows up:

<ASP:Datalist id="dlComments" Font-name="Arial" Font-size="11px"
Runat="server" CellPadding="5" CellSpacing="0" RepeatColumns="5"
RepeatDirection="Vertical" RepeatLayout="Table" Gridlines="Both">

<EditItemTemplate>
<tr>
<td class="update-fields" nowrap>Comments</td>
<td class="text" width="343"><asp:TextBox id="txtComments"
runat="server" MaxLength="40" Columns="40" Text='<%#
Container.DataItem("Comments") %>' /></td>
</tr>
</EditItemTemplate>
</ASP:Datalist>

When I change EditItemTemplate to ItemTemplate it shows up fine.
Normally I'll put the datalist into Edit Mode when the user clicks
'Edit'. Using this code:

Sub dlComments_Edit(sender as Object, e as DataListCommandEventArgs)
dlComments.EditItemIndex = e.Item.ItemIndex
BindData()
End Sub

But how can I put the Datalist in Edit Mode on page load?? I'm sure
it's simple but I can't seem to figure it out.

Thanks for any help.
 

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

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top