Hi, I couldnt make the changes working.
This is the code im using right now :
HTML side:
<asp:DropDownList id=DropDownList2 runat="server" Font-Names="Tahoma" Font-Size="11px" Width="112px" DataSource="<%#BindState()%>" DataTextField="nameT" DataValueField="code"></asp:DropDownList>
VB.Net side:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
bindData()
End If
End Sub
Sub bindData()
Dim conn As New SqlClient.SqlConnection
conn.ConnectionString = ConfigurationSettings.AppSettings("SqlConn")
conn.Open()
Dim ds As New DataSet
Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter("SELECT r.code AS requestCode, e.name AS entName, r.localization, r.efectivedate, r.toinvoice " & _
" FROM request r INNER JOIN " & _
" entity e ON r.destinationentity = e.code " & _
" WHERE (r.state = 1) AND (e.state = 1) and groupid='" & Session("groupId") & "'", conn)
Session.Remove("groupId")
da.Fill(ds)
DataGrid1.DataSource = ds
DataGrid1.DataBind()
End Sub
Public Function BindState()
Dim funcVb As New funcoesVb
Dim dtt As New DataTable
Dim strVal As String = "0| "
dtt = funcVb.GetDr("select code as code, name as nameT from entitylocalization where state=1", strVal)
Return dtt
End Function
What am i doing wrong???
Enter your message below
Sign in or Join us (it's free).