problem to get the dynamic fields of a datalist

C

charmetton

Hello all,
I try to create a part of a form with a datalist:

<ASP:DataList id="formulaire" runat="server"
RepeatDirection="Horizontal" ItemStyle-Width="100%">
<ItemTemplate>
<table>
<tr>
<td class="titre_paragraphe" align="right">PDF <%#
DataBinder.Eval(Container.DataItem, "LANG") %></td>
<td align="left"><input id="pdfSelect<%#
DataBinder.Eval(Container.DataItem, "LANG%>" name
="pdfSelect<%# DataBinder.Eval(Container.DataItem, "LANG%>"
type="file" /></td>
</tr>
</table>
</ItemTemplate>
</ASP:DataList>

So a <input type="file"> is created for each Language (LANG) a
request send me.
Then i try to get the fields in my code behind with this way:

[i:39fe8b4321]Field_pdf = CType(FindControl("pdfSelect" &
lang),System.Web.UI.HtmlControls.HtmlInputFile)[/i:39fe8b4321]

Unfortunately it doesn't work! In fact when i make a quickwatch in my
form, these fields don't exist... :?
Is somebody can help me with this point please?
Thanks in advance.
Julien

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
J

Jeffrey Palermo [MCP]

Julien,
you must have runat="server" on the controls to make them server
controls. Then you will be able to use them in the code-behind.

Best regards,
Jeffrey Palermo
 

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

Top