I've got the following Datagrid columns:
When a user clicks the Hyperlink, I want it to redirect them to a new page, which will display the appropriate detail. I'm trying to capture the "Header Text" and the actual text of the hyperlink. I've been able to capture the Header text (it is hardcoded), but I've not been able to capture the actual hyperlink text. Here is what I have:
I was hoping to capture the text of the hyperlink itself and then evaluate before the redirect (it is a "Y" or "N"). Also, since there are two hyperlink columns, is there a way to capture which column is being clicked and it's corresponding header (I have it hard coded right now).
Code:
<Columns>
<asp:BoundColumn DataField="h_name" HeaderText="Name"></asp:BoundColumn>
<asp:BoundColumn DataField="h_exposure" HeaderText="Insur Amt"></asp:BoundColumn>
<asp:BoundColumn DataField="h_ind" HeaderText="Future Ind"></asp:BoundColumn>
<asp:BoundColumn DataField="sw_insur" HeaderText="Hazard Ins"></asp:BoundColumn>
<asp:BoundColumn DataField="sw_type" HeaderText="Deposit Acct"></asp:BoundColumn>
<asp:HyperLinkColumn Text="sw_excep" DataTextField="sw_excep" HeaderText="Docu Excep" NavigateUrl="SearchDetailsExpand.aspx"></asp:HyperLinkColumn>
<asp:HyperLinkColumn Text="sw_life" DataTextField="sw_life" HeaderText="Life Insur" NavigateUrl="SearchDetailsExpand.aspx"></asp:HyperLinkColumn>
</Columns>
When a user clicks the Hyperlink, I want it to redirect them to a new page, which will display the appropriate detail. I'm trying to capture the "Header Text" and the actual text of the hyperlink. I've been able to capture the Header text (it is hardcoded), but I've not been able to capture the actual hyperlink text. Here is what I have:
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Panel1.Controls.Add(Me.LoadControl("Banner.ascx"))
Panel2.Controls.Add(Me.LoadControl("Left.ascx"))
Dim cf As New MandT.CLD.Inquiry.BusinessTier.BLL
ObligorAllDataSet = cf.GetObligorAll(Session("obligor"))
DetailMaster.DataSource = ObligorAllDataSet
DetailMaster.DataBind()
End Sub
Private Sub DetailMaster_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DetailMaster.ItemDataBound
Dim i As Integer = e.Item.Cells.Count - 1
Dim strType As String = CType(DetailMaster.Controls(0).Controls(1), DataGridItem).Cells(e.Item.Cells.Count - 2).Text ' Header Text with hard coding the cell index
Session("ExpandType") = strType
Session("ExpandValue") = strValue
End Sub
I was hoping to capture the text of the hyperlink itself and then evaluate before the redirect (it is a "Y" or "N"). Also, since there are two hyperlink columns, is there a way to capture which column is being clicked and it's corresponding header (I have it hard coded right now).