A
Arpan
Assume that a database table has the following 4 columns - ID, UserID,
Subject & Marks. I am retrieving the records existing in this DB table
& displaying them in a DataGrid like this:
<script runat="server">
Sub Page_Load(obj As Object, ea As EventArgs)
Dim dSet As DataSet
Dim sqlConn As SqlConnection
Dim sqlDapter As SqlDataAdapter
sqlConn = New SqlConnection("........")
sqlDapter = New SqlDataAdapter("SELECT * FROM tblMarks",
sqlConn)
dSet = New DataSet
sqlDapter.Fill(dSet, "Marks")
dgMarks.DataSource = dSet
dgMarks.DataBind()
End Sub
</script>
<form eunat="server">
<asp
ataGrid ID="dgMarks" HeaderStyle-Font-Bold="true"
HeaderStyle-HorizontalAlign="center" runat="server"/>
</form>
The above will retrieve & display all the records existing in the 4
columns in the DataGrid. By default all the records in the different
cells in the DataGrid will be left-aligned. Now I want only the records
existing under the ID column to be right-aligned & the records existing
under the Marks column to be center-aligned. The records under UserID &
Subject columns should remain left-aligned.
How do I accomplish this?
Thanks,
Arpan
Subject & Marks. I am retrieving the records existing in this DB table
& displaying them in a DataGrid like this:
<script runat="server">
Sub Page_Load(obj As Object, ea As EventArgs)
Dim dSet As DataSet
Dim sqlConn As SqlConnection
Dim sqlDapter As SqlDataAdapter
sqlConn = New SqlConnection("........")
sqlDapter = New SqlDataAdapter("SELECT * FROM tblMarks",
sqlConn)
dSet = New DataSet
sqlDapter.Fill(dSet, "Marks")
dgMarks.DataSource = dSet
dgMarks.DataBind()
End Sub
</script>
<form eunat="server">
<asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
HeaderStyle-HorizontalAlign="center" runat="server"/>
</form>
The above will retrieve & display all the records existing in the 4
columns in the DataGrid. By default all the records in the different
cells in the DataGrid will be left-aligned. Now I want only the records
existing under the ID column to be right-aligned & the records existing
under the Marks column to be center-aligned. The records under UserID &
Subject columns should remain left-aligned.
How do I accomplish this?
Thanks,
Arpan