@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="addfaculty_subj.aspx.vb" Inherits="addfaculty_subj" title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="adminPlaceHolder1" Runat="Server"> <script src="js/jquery-1.8.3.js" type="text/javascript" language="javascript"></script> <script src="js/jquery-ui.js" type="text/javascript" language="javascript"></script> <script type="text/javascript" language="javascript"> function LoadList() { var ds=null; ds = <%=listFilter %>; $( "#tb_empid" ).autocomplete({ source: ds }); } </script> <table style="left: 94px; width: 578px; position: relative; top: 13px;" id="TABLE2" onclick="return TABLE2_onclick()" onload="LoadList()" > <TBODY> <tr> <td colspan="1" rowspan="2" style="left: 5px; width: 3px; position: relative; text-align: left"> <asp:Image id="Image1" runat="server" Height="242px" ImageUrl="~/images/fac.jpg" Width="164px"> </asp:Image> </td> <td colspan="2" style="height:18px; text-align: center; left: 5px; position: relative;"> <span style="font-size: 11pt"> <strong> ADD FACULTY&THEIR SUBJECT NAME </strong></span> </td> </tr> <TR> <TD style="LEFT: 5px; POSITION: relative; HEIGHT: 18px; TEXT-ALIGN: left" colSpan=3> <TABLE style="LEFT: 40px; WIDTH: 582px; HEIGHT: 157px; font-weight: bold;" id="TABLE1"> <TBODY> <TR> <TD style="WIDTH: 292px; HEIGHT: 24px; TEXT-ALIGN: center">Course</TD> <TD style="WIDTH: 54px; HEIGHT: 24px" align=center> <asp:DropDownList id="dl_course1" runat="server" Width="155px" AutoPostBack="True" TabIndex="1"> <asp:ListItem Text="--Select One--"></asp:ListItem> </asp:DropDownList> </TD> <TD style="FONT-WEIGHT: bold; WIDTH: 197px; HEIGHT: 24px; TEXT-ALIGN: center">Branch</TD> <TD style="WIDTH: 202px; HEIGHT: 24px" align=left colSpan=1> <asp:DropDownList id="dl_branch1" runat="server" Width="155px" AutoPostBack="True" TabIndex="2"> <asp:ListItem Text="--Select One--"></asp:ListItem> </asp:DropDownList> </TD> </TR> <TR> <TD style="WIDTH: 292px; HEIGHT: 16px; TEXT-ALIGN: center">Batch</TD> <TD style="WIDTH: 54px; HEIGHT: 16px" align=center> <asp:DropDownList id="dl_batch1" runat="server" Width="155px" AutoPostBack="True" TabIndex="3"> <asp:ListItem Text="--Select One--"></asp:ListItem> </asp:DropDownList> </TD> <TD style="WIDTH: 197px; HEIGHT: 16px; TEXT-ALIGN: center">Semester</TD> <TD style="WIDTH: 202px; HEIGHT: 16px" align=left colSpan=1> <asp:DropDownList id="dl_sem1" runat="server" Width="155px" AutoPostBack="True" TabIndex="4" onload="LoadList()"> <asp:ListItem Text="--Select One--"></asp:ListItem> </asp:DropDownList> </TD> </TR> <TR> <TD style="WIDTH: 292px; HEIGHT: 1px" align=center>Subject Code</TD> <TD style="WIDTH: 54px; HEIGHT: 1px" align=center> <asp:DropDownList id="dl_scd" runat="server" Width="153px" TabIndex="5"> <asp:ListItem Text="--Select One--"></asp:ListItem> </asp:DropDownList> </TD> <td style="text-align: center"> EmpName</td> <td> <asp:TextBox ID="tb_empid" runat="server" AutoPostBack="True" MaxLength="10"></asp:TextBox> </TD> </TR> <TR> <TD style="HEIGHT: 11px; text-align: right;" colSpan=4> <asp:Button id="b_save" runat="server" Text="Save Record" Width="92px" TabIndex="8"> </asp:Button> <asp:Button id="b_back" runat="server" Text="Back" Width="94px" TabIndex="9"> </asp:Button> </TD> </TR> </TBODY> </TABLE> </TD> </TR> </TBODY> </table> </asp:Content>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'connection string' con = New SqlConnection("Data Source=128.100.1.38;Initial Catalog=appraisal;User ID=sa;Password=database") con.Open() listFilter = Nothing listFilter = BindName() 'fetching course deatil' If Not IsPostBack Then cm = New SqlCommand("select * from course_mst ", con) da = New SqlDataAdapter(cm) ds = New DataSet da.Fill(ds, "cour") dt = New DataTable dt = ds.Tables("cour") While i <= dt.Rows.Count - 1 Me.dl_course1.Items.Add(dt.Rows(i).Item("course_name").ToString) i = i + 1 End While i = 0 End If Me.dl_course1.Focus() End Sub
Private Function BindName() As String Dim dt As DataTable = Nothing cm = New SqlCommand("SELECT empid_name FROM v_empid_name", con) da = New SqlDataAdapter(cm) ds = New DataSet da.Fill(ds, "ename") dt = New DataTable dt = ds.Tables("ename") Dim output As New StringBuilder() output.Append("[") For i As Integer = 0 To dt.Rows.Count - 1 output.Append("""" & dt.Rows(i)("empid_name").ToString() & """") If i <> (dt.Rows.Count - 1) Then output.Append(",") End If Next output.Append("];") Return output.ToString() End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)