Hello Anson,
Please refer to the examples below. They show how to set a hyperlink caption based on datasource values. Do they suit you?
How to create a DataItem template for a grid column at runtime
How to change styles for a hyperlink column
How to create and configure a HyperLink column at runtime
How to use a hyperlink whose argument depends on several cell values in the ASPxGridView
Thanks,
Marion
Thanks for your reply.
Actually, I have read those posts before but none of them suit for me because we need to based on the Hyperlink column click to change ASPxTabPage instead of redirecting somewhere. As you can see the demo project, I can handle the Column Click Event that I am going to change Tab Page based on the user selection.
Thanks.
Anson,
Thank you for your clarification. I would like to note that by design, while in callback processing, our ASP.NET controls can update only their own rendering, but not the rendering of outside controls. Therefore, it is impossible to change the ASPxTabPage page on the server-side ASPxGridView.CustomButtonCallback event handler. To learn more, please refer to the following knowledge base article:
ID: K18387, The Concept of Callbacks
In your case, I suggest that you utilize the following scenario:
1. Put ASPxTabPage onto ASPxCallbackPanel;
2. Put ASPxHyperLink onto DataItemTemplate;
3. Handle the client-side ASPxHyperLink.Click event as shown below:
[ASPx]<DataItemTemplate> <dx:ASPxHyperLink ID="ASPxHyperLink1" runat="server" Text='<%#Eval("EmployeeID") %>'> <ClientSideEvents Click="OnASPxHyperLink1Click" /> </dx:ASPxHyperLink> </DataItemTemplate>
4. Perform a callback to ASPxCallbackPanel:
[JScript]function OnASPxHyperLink1Click(s, e) { panel.PerformCallback('some parameter'); }
5. In the ASPxCallbackPanel.Callback event handler, you can change the active tab page.
6. Please use the ASPxHyperLink.JSProperties property to pass some information from server to client;
7. You can use the same approach with standard grid CustomButtons. In this case, you should only handle the ASPxClientGridView.CustomButtonClick event.
Also, you can use ASPxButton inside DataItemTemplate, handle its server-side Click event and change the active tab page as shown in the How to display master-detail tables in two grids on separate tabs of a PageControl example;
In you need further clarification, let me know.
Thanks,
Marion
It is my mistake. I can get the client event when the use click on the hyperlink but cannot get the right focusedrowindex of the grid view. Please check the sample project.
Thanks
Anson,
Thank you for your sample. In fact your issue is caused by fact that you do not enable grid focusing. Please set the ASPxGridViewBehaviorSettings.AllowFocusedRow property to true to accomplish this task.
However, I would like to note that it is not possible to focus a row until you set the ASPxGridView.KeyFieldName property. Please do it.
>>And the Hyperlink mouse hover cursor is not the same as a Normal Hyperlink? Would you tell me
Please use the style cursor property to change the cursor view. For example:
[ASPx]<dx:ASPxHyperLink ID="ASPxHyperLinkProjectNumber" runat="server" style="cursor:pointer">
Thanks,
Marion
P.S. Our team is dedicated to addressing all your concerns. In order to better serve and track multiple questions from your inquiry, we have taken the liberty of separating the issues you addressed. For quick and efficient responses to your concerns, we kindly request that future inquiries address one issue at a time. Your time and cooperation are appreciated.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.
Facebook
Twitter
Google+