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

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top