View Single Post
Old 27-Feb-2007, 04:47 AM   #1 (permalink)
Sangeetha
Fixed Error!
 
Sangeetha's Avatar

Posts: 139
Location: Chennai
Join Date: Feb 2007
Rep Power: 2 Sangeetha is on a distinguished road

IM:
Default Gridview Hyperlink in ASP.NET 2.0 using VB

have a GridView to show data within a table format. The columns are bound. How would I make a particular column value a hyperlink?

Is there a way, instead of making the asp:BoundField, I could use asp:Hyperlink; however, how would I populate?

Here's the code that I'm using to create table:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Height="40px" Width="722px">
<Columns>
<asp:BoundField DataField="Shift" HeaderText="Shift" SortExpression="Shift">
<HeaderStyle BackColor="#E0E0E0" />
<ItemStyle BackColor="White" BorderColor="Transparent" Width="150px" />
</asp:BoundField>
</Columns>
</asp:GridView>

Here's the code that is generating the SqlDataSource.

Private Sub GenerateGridQueryString()

strGridString = "SELECT tblShift.Shift, tblUnit.Unit_description, tblPriority.Priority_description, "
strGridString &= "tblLog.Log_Note, tblLog.tag_number, tblOperator.NTID, tblPriority.Priority FROM tblLog "
strGridString &= "INNER JOIN tblShift ON tblLog.ShiftID = tblShift.ShiftID INNER JOIN tblPriority ON "
strGridString &= " tblLog.priority_id = tblPriority.priority_id INNER JOIN tblUnit ON tblLog.unit_id = tblUnit.unit_id"
strGridString &= " INNER JOIN tblOperator ON tblShift.OperatorID = tblOperator.OperatorID"
strGridString &= " WHERE (tblShift.Shift = '" & strShiftID & "')"

SqlDataSource1.SelectCommand = strGridString

End Sub
Sangeetha is offline   Reply With Quote