I have this code right here. I have a grid where a column has an orderID with a hyperlink calling a method called getorderInfo that opens a new page with a grid for the order info. Though I don’t need a new page. I need it to stay on the same page and have the grid show up at the bottom.
I tried a couple different things, all results in either a new page or a popup. I tried to look up something like this online, though I had no luck. The best I could do is a new page, though I’m hoping there’s something obvious I’m missing to dynamically change the current page from having one grid to 2.
<rad:GridTemplateColumn DataField="OrderId" DataType="System.Int32" SortExpression="OrderId"
UniqueName="OrderId">
<ItemTemplate>
<!--- link--->
<asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl='<%# GetOrderInfo(Eval("OrderId")) %>'
Text='<%# Eval("OrderId") %>' />
</ItemTemplate>
</rad:GridTemplateColumn>
Protected Function GetOrderInfo(ByVal OrderId As Integer) As String
Return String.Format("javascript:editItem(""{0}"",""{1}"",""{2}"");", "OrderInfo.aspx", "OrderId", Server.HtmlEncode(OrderId))
End Function
2
Answers
Why not consider just having two simple div areas on the web page?
So, when a user clicks on one row of the GridView, you then hide the GridView (and area), and then display the second grid area along with some details.
User’s find this type of UI easy to use, and the bonus points are writing such code is also rather easy.
So, for this example, let’s assume we have a list of hotels (in a GridView).
We are to click on one of the hotels, and display people booked into that one hotel in another GridView.
So, our first GridView (list of hotels).
Note the simple div with a runat="server". The runat=server tag allows code behind with ease to hide that first GridView area, and show the second GridView area.
In this case the second grid will show people booked into the hotel selected from the first grid.
So, below the above first div and grid area, we drop in our second div area with our second GridView.
This:
Code behind to make all this magic work is rather simple:
The row button click code for above GridView:
So, the above results in this effect:
So, this rather simple approach of hide and showing the top first grid, and then showing the second grid area upon row selection is very little code.
The end result is an initiative user interface, and one that requires little developer efforts.
You likely need to set the hyperlinks target attribute to point at the correct frame. Try setting the target on your asp hyperlink to "_self" like so:
MSDN ASP Hyperlink Target Property