I have a project in which one column is a hyperlink column. Ideally, when the user clicks on the hyperlink, three things happen:
1. The row the hyperlink is in is selected
2. The data in the hyperlink column is passed to a session variable
3. A new browser window opens up, and the session variable is passed to the new page in that separate window.
Currently, it appears that the only thing that is taking place is that a new browser window opens up, in spite of the fact that I have the appropriate code in the SelectedIndexChanged event that would pass the data into the session variable. I hope someone can help me with this, or perhaps suggest a more efficient way of accomplishing this task. Here is the relevant code:
the .aspx:
And here's the codebehind:
1. The row the hyperlink is in is selected
2. The data in the hyperlink column is passed to a session variable
3. A new browser window opens up, and the session variable is passed to the new page in that separate window.
Currently, it appears that the only thing that is taking place is that a new browser window opens up, in spite of the fact that I have the appropriate code in the SelectedIndexChanged event that would pass the data into the session variable. I hope someone can help me with this, or perhaps suggest a more efficient way of accomplishing this task. Here is the relevant code:
the .aspx:
<telerik:RadGrid ID="rgPoOrders" runat="server" DataSourceID="dsPurchaseOrders" |
GridLines="None"> |
<MasterTableView ItemStyle-HorizontalAlign="Center" AutoGenerateColumns="False" Width="95%" |
DataKeyNames="cpono" DataSourceID="dsPurchaseOrders" GridLines="Horizontal" AlternatingItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
<ExpandCollapseColumn> |
<HeaderStyle Width="20px" /> |
</ExpandCollapseColumn> |
<Columns> |
<telerik:GridBoundColumn DataField="cpono" HeaderText="PO #" ReadOnly="True" |
SortExpression="cpono" UniqueName="cpono"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="DateOnly" DataType="System.DateTime" |
HeaderText="Date Submitted" SortExpression="DateOnly" UniqueName="DateOnly"> |
</telerik:GridBoundColumn> |
<telerik:GridHyperLinkColumn DataTextField="cshortrmk" HeaderText="Tracking #" |
Target="_blank" UniqueName="cshortrmk" NavigateUrl="UpsTrack.aspx"> |
</telerik:GridHyperLinkColumn> |
</Columns> |
<ItemStyle HorizontalAlign="Center" /> |
<AlternatingItemStyle HorizontalAlign="Center" /> |
<HeaderStyle HorizontalAlign="Center" /> |
</MasterTableView> |
</telerik:RadGrid> |
<asp:ObjectDataSource ID="dsPurchaseOrders" runat="server" |
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" |
TypeName="OrderEntryTableAdapters.POSelectCommandTableAdapter"> |
<SelectParameters> |
<asp:SessionParameter Name="FName" SessionField="FName" Type="String" /> |
<asp:SessionParameter Name="LName" SessionField="LName" Type="String" /> |
</SelectParameters> |
</asp:ObjectDataSource> |
And here's the codebehind:
Protected Sub rgPoOrders_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rgPoOrders.SelectedIndexChanged |
Dim TrackNum As String |
Dim selectedItem As GridDataItem = rgPoOrders.SelectedItems(0) |
TrackNum = selectedItem(rgPoOrders.MasterTableView.Columns(3)).Text |
Session.Add("TrackNum", TrackNum) |
test.Text = TrackNum |
End Sub |