ListView::InsertItemTemplate / ObjectDataSource

  • Thread starter Thread starter Lubomir
  • Start date Start date
L

Lubomir

Hi, I have a ListView control and <InserItemTemplate> template.

<InsertItemTemplate>
<asp:Table runat =…..>
<asp:TableRow runat …>
<asp:TextBox ID=â€someTextBox†text=’<%# Bind(“AAAâ€) %> runat =
…/>
</asp:TableRow>
</asp:Table>
</InsertItemTemplate>

The ObjectDataSource is bound to the ListView:
<asp:ObjectDataSource ID=â€mydatasource†runat…>
<InsertParameters>
<asp:ControlParameter Name=â€ctrlPrm†ControlId=†someTextBoxâ€
PropertyName=â€Text†… />
</InsertParameters>
</asp:ObjectDataSource>


When I run the code and try to execute Insert command, I get exception, that
the control “someTextBox†could not be found.

On the net I found opinions that ObjectDataSource can not find the control
because it has a different ID during the runtime. However, this renders
ObjectDataSource to be not very usefull.

How should I pass the parameter “ctrlPrm†to the ObjectDataSource (Insert
command) ?
I know there has been made some changes in the ListViewControl in .NET 4.
Will be this behaviour changed?

Thanks,
Lubomir
 
Back
Top