M
Mad Scientist Jr
I am having a hard time figuring out how to set header text for a
datagrid - I have found a number of pages on it but none work. Some
seem to be for vb.net desktop applications not web.
Can someone help? Below is my code, I want to set the header text to:
"My<br>Header<br>One" for MyField1
"My<br>Header<br>Two" for MyField2
"My<br>Header<br>Three" for MyField3
Note that I would like the line breaks in there. Any help
appreciated...
Dim sbSQL As New StringBuilder
sbSQL.Append("SELECT [vbcrlf/]")
sbSQL.Append(" [ID], [vbcrlf/]")
sbSQL.Append(" MyField1, [vbcrlf/]")
sbSQL.Append(" CONVERT(decimal(10,2), MyField2) as MyField2,
[vbcrlf/]")
sbSQL.Append(" MyField3 [vbcrlf/]")
sbSQL.Append("FROM [vbcrlf/]")
sbSQL.Append(" MyTable [vbcrlf/]")
sbSQL.Replace("[vbcrlf/]", vbCrLf)
Dim DataSet1 As DataSet
DataSet1 = New DataSet
Dim SqlConnection1 As SqlConnection
Dim SqlDataAdapter1 As SqlDataAdapter
SqlConnection1 = New
SqlConnection(System.Configuration.ConfigurationSettings.AppSettings.Get("DbConnString"))
SqlDataAdapter1 = New SqlDataAdapter(sbSQL.ToString, SqlConnection1)
SqlDataAdapter1.Fill(DataSet1)
SqlConnection1.Close()
SqlConnection1.Dispose()
SqlDataAdapter1.Dispose()
DataView1 = DataSet1.Tables(0).DefaultView
DataGrid1.DataSource = DataView1
DataView1.Sort = "MyField2, MyField1, MyField3 "
DataGrid1.DataBind()
datagrid - I have found a number of pages on it but none work. Some
seem to be for vb.net desktop applications not web.
Can someone help? Below is my code, I want to set the header text to:
"My<br>Header<br>One" for MyField1
"My<br>Header<br>Two" for MyField2
"My<br>Header<br>Three" for MyField3
Note that I would like the line breaks in there. Any help
appreciated...
Dim sbSQL As New StringBuilder
sbSQL.Append("SELECT [vbcrlf/]")
sbSQL.Append(" [ID], [vbcrlf/]")
sbSQL.Append(" MyField1, [vbcrlf/]")
sbSQL.Append(" CONVERT(decimal(10,2), MyField2) as MyField2,
[vbcrlf/]")
sbSQL.Append(" MyField3 [vbcrlf/]")
sbSQL.Append("FROM [vbcrlf/]")
sbSQL.Append(" MyTable [vbcrlf/]")
sbSQL.Replace("[vbcrlf/]", vbCrLf)
Dim DataSet1 As DataSet
DataSet1 = New DataSet
Dim SqlConnection1 As SqlConnection
Dim SqlDataAdapter1 As SqlDataAdapter
SqlConnection1 = New
SqlConnection(System.Configuration.ConfigurationSettings.AppSettings.Get("DbConnString"))
SqlDataAdapter1 = New SqlDataAdapter(sbSQL.ToString, SqlConnection1)
SqlDataAdapter1.Fill(DataSet1)
SqlConnection1.Close()
SqlConnection1.Dispose()
SqlDataAdapter1.Dispose()
DataView1 = DataSet1.Tables(0).DefaultView
DataGrid1.DataSource = DataView1
DataView1.Sort = "MyField2, MyField1, MyField3 "
DataGrid1.DataBind()