Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Text Value of Hyperlink Column in ASP.NET 1

Status
Not open for further replies.

byrne1

Programmer
Aug 7, 2001
415
US
I need to know how to programatically get the text value of a hyperlink column in a datagrid. A column in my datagrid is a hyperlink to another page (the field that this column is bound to is used as a key in my SQL tables).

I also have a Delete column on the datagrid that needs to use the value of the hyperlink column to delete records from my table. When I try to access the Text property of the column it says that it is blank.

I have included some code below.

HTML CODE
-------------------------------
<asp:datagrid id=&quot;DataGrid1&quot; runat=&quot;server&quot; Font-Size=&quot;10pt&quot; AlternatingItemStyle-BackColor=&quot;#ffffcc&quot; autogeneratecolumns=&quot;False&quot;>
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField=&quot;CaseNbr&quot; DataTextField=&quot;CaseNbr&quot; HeaderText=&quot;Case #&quot; NavigateUrl=&quot;Details.aspx&quot;></asp:HyperLinkColumn>
</Columns>
</asp:datagrid>


VB CODE
------------------------------
Private Sub DataGrid1_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.DeleteCommand
Dim index As Integer
index = e.Item.ItemIndex
' Add code to delete data from data source.
Dim de As String
de = DataGrid1.Items(index).Cells(0).Text
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top