The code
=================================
<%@ Page Language="
vb" Debug="true" %>
<%@ Import Namespace="System.Data.OLEDB" %>
<script language="
VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
If (Not Page.IsPostBack)
Dim strConn as string ="Provider=Microsoft.Jet.OLEDB.4.0;"
strConn += "Data source=C:\website\db1.mdb;"
Dim strSQL as string ="select skillid, SkillName from skillset "
Dim Conn as New OLEDBConnection(strConn)
Dim Cmd as New OLEDBCommand(strSQL,Conn)
Conn.Open()
dgNameList1.DataSource = Cmd.ExecuteReader(system.data.CommandBehavior.Clos eConnection)
dgNameList1.DataBind()
End If
End Sub
</script>
<html>
<form runat="server">
<asp:datagrid
id="dgnamelist1"
autogeneratecolumns=false runat="server">
<columns>
<asp:templatecolumn headertext="plese select">
<itemtemplate>
<asp:dropdownlist id="level" size=1 runat="server">
<asp:ListItem>0</asp:ListItem>
<asp:listitem>1</asp:listitem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:dropdownlist>
<asp:label id="hdnskillid" visible="false" text='<%#databinder.eval(container.dataitem,"skill id")%>' runat=server/>
</itemtemplate>
</asp:templatecolumn>
<asp:templatecolumn headertext="SkillName">
<itemtemplate>
<asp:label id="lblskillname" text='<%#databinder.eval(container.dataitem,"skill name")%>' runat=server/>
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
<input type="button" id="btnselect" onserverclick="btnselect_onclick" value="select" runat="server">
</form>
</html>
Problem
====================
The table used is skillset table and has the data stored as(used for sql for above code)
skillid Skill Name
1 Java
2 .net
3 HTML
4 C++
5
Vb
And so on
.
.
Now when Skillid 1 that is Java is shown the dorpdownlist should show 5.
When skillid 2 that is .net is shown the dorpdownlist should show 1.
When skillid3 that is HTML is shown the dorpdownlist should show 2
And so onâ¦
1. How do I do it?
2. if my pageload file was in the code behind file that is *.
vb file how would I make the selection of the dropdownlist.