如何手动将数据绑定到数据列表
我希望用户能够单击一个按钮,然后它运行一个函数,然后在数据列表中显示结果。
我知道我可以获取数据并通过我的表绑定它
Sub BindCommsDataList(ByVal dlComms As DataList, ByVal sAddrno As String, ByVal sNameNo As String)
Dim mySelectQuery As String = "SELECT * FROM table"
Dim myConnection As New MySqlConnection(Session("localConn"))
Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myDataAdapter = New MySqlDataAdapter(myCommand)
Dim myDataSet As New DataSet
myDataAdapter.Fill(myDataSet, "comms")
dlComms.DataSource = myDataSet
dlComms.DataKeyField = "seq"
dlComms.DataBind()
myConnection.Close()
End Sub
但是我如何运行手动绑定数据的函数
编辑:
恢复的数据将采用文本格式。所以理想情况下我只想做..
RtnDealerName.Text = xoGetWebPage.RtnDealerName
但它说我无权访问 RtnDealerName
I want to be able for a user to click on a button and then it runs a function and then shows the results in the data list.
i know i can get data and bind it through my tables
Sub BindCommsDataList(ByVal dlComms As DataList, ByVal sAddrno As String, ByVal sNameNo As String)
Dim mySelectQuery As String = "SELECT * FROM table"
Dim myConnection As New MySqlConnection(Session("localConn"))
Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myDataAdapter = New MySqlDataAdapter(myCommand)
Dim myDataSet As New DataSet
myDataAdapter.Fill(myDataSet, "comms")
dlComms.DataSource = myDataSet
dlComms.DataKeyField = "seq"
dlComms.DataBind()
myConnection.Close()
End Sub
But how do i run a function which binds data manually
EDIT:
The data revived back will be in text format. So ideally i just want to do..
RtnDealerName.Text = xoGetWebPage.RtnDealerName
but it says i dont have access to RtnDealerName
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为没有任何方法可以将项目直接添加到 DataList 控件,但您可以使用结果来构建数据源控件,例如 DataTable:
以下是 DataList 控件的一些简单标记:
I don't think there's any way to add items directly to the DataList control, but you can use the results to build a datasource control, like a DataTable for example:
Here's some simple markup for the DataList control: