![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Knowledge Base Most common error and how to trouble shoot them off |
![]() |
|
Gridview Hyperlink in ASP.NET 2.0 using VB
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Fixed Error!
Posts: 141
Location: Chennai
Join Date: Feb 2007
Rep Power: 2
IM:
|
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 |
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Fixed Error!
Posts: 141
Location: Chennai
Join Date: Feb 2007
Rep Power: 2
IM:
|
For example: <asp:HyperLinkField HeaderText="your header" DataTextField="The field you want to display" DataNavigateUrlFields="The field that will provide the navigation, usually an ID field" DataNavigateUrlFormatString="yourpage.aspx?id={0}" /> |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|