SetIndex as Function in VS.Net

P

Patrick.O.Ige

If i use (How would i declare SetIndex or would i have to declare
DopDownList or TemplateColumn in Visual
Studio .Net) :-
Thx for the help in advance!!!

Function SetIndex(TheItem As String)
Dim i As Integer
For i = 0 To ItemTypes.Count - 1
If TheItem = ItemTypes(i) Then
Return i
End If
Next
End Function

And in Html i use it here as:-
------------------------------
<asp:TemplateColumn>
<HeaderTemplate>
Type<br>
<asp:DropDownList id="ItemType" runat="server"
DataSource='<%# ItemTypes %>'/>
</HeaderTemplate>
<ItemTemplate>
<asp:DropDownList id="ItemType" runat="server"
DataSource='<%# ItemTypes %>'
SelectedIndex='<%# SetIndex(Container.DataItem("ItemType")) %>'/>
</ItemTemplate>
</asp:TemplateColumn>
 

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
473,777
Messages
2,569,604
Members
45,205
Latest member
ShereeStan

Latest Threads

Top