ListBox inside grid view

S

SimonZ

If I have gridView and one of the columns is template cpolumn, where I have
listBox in edit mode:

<asp:TemplateField>
<HeaderTemplate>CategorName:</HeaderTemplate>
<ItemTemplate>
<asp:Label runat="server" text='<%#
Eval("CategoryName")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:ListBox Rows=1 runat="server" ID=lstCat
DataSourceID="SqlDataSource3" DataValueField="CategoryID"
DataTextField="CategoryName"></asp:ListBox>
</EditItemTemplate>
</asp:TemplateField>

In sqlDataSource I have defined update parameter:
<asp:ControlParameter ControlID="lstCat" Name="CategoryID"
PropertyName="SelectedValue" Type="Int32" />


When I click Update I can't read the value from my list box:
Could not find control 'lstCat' in ControlParameter 'CategoryID'.

How can I read the value from control which is inside grid view?

If I move this control outside the gridView it works.

It looks like that you can't read the controls which are inside other
controls.

Any idea?
Regards,Simon
 

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,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top