查看: 679|回复: 1
|
关于TemplateColumn的问题(asp.net)
[复制链接]
|
|
以下是我的code, 我要如何将sql query result (name) display在红色highlight的地方?
<ASP: DataGrid id="MyDataGrid" runat="server" >
<Columns>
<asp:TemplateColumn HeaderText="Employeeid">
<ItemTemplate>
<asp:Hyperlink runat="server" Text="name" NavigateUrl="result.aspx"
ID="Hyperlink1"/>
</ItemTemplate>
<asp:BoundColumn DataField="age" HeaderText="age"></asp:BoundColumn>
</Columns>
</ASP: DataGrid>
////////////////////////////////////////////////////////////////////////////////
Private Sub Page_Load()
Dim DS As New DataSet = display_notes()
Me.MyDataGrid.DataSource = DS.Tables("notes_table").DefaultView
Me.MyDataGrid.DataBind()
End Sub
/////////////////////////////////////////////////////////////////////////
Public sub display_notes() As DataSet
Dim mydataadapter As OdbcDataAdapter
Dim mydataset As DataSet
Str = "SELECT name, age FROM customer"
Try
mydataadapter = New OdbcDataAdapter(Str, MyConn)
mydataset = New DataSet
mydataadapter.Fill(mydataset, "notes_table")
Catch ex As Exception
errormsg = ex.Message()
End Try
If Not MyConn Is Nothing Then
MyConn.Close()
End If
Return mydataset
End Sub
[ 本帖最后由 counterking 于 19-7-2006 04:42 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 19-7-2006 05:38 PM
|
显示全部楼层
<asp:Hyperlink runat="server" Text='<%#bind("name")%>' NavigateUrl="result.aspx"
ID="Hyperlink1"/> |
|
|
|
|
|
|
| |
本周最热论坛帖子
|