Connecting Tech Pros Worldwide Forums | Help | Site Map

problem to get the dynamic fields of a datalist

charmetton
Guest
 
Posts: n/a
#1: Nov 18 '05
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
*-----------------------*

Jeffrey Palermo [MCP]
Guest
 
Posts: n/a
#2: Nov 18 '05

re: problem to get the dynamic fields of a datalist


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

"charmetton" <jcharmetton@groupeseb-dot-com.no-spam.invalid> wrote in
message news:419b4ac0$1_4@Usenet.com...[color=blue]
> 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
> *-----------------------*[/color]


Closed Thread